Attention is currently required from: arehbein, fixeria, pespin. neels has posted comments on this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/30602 ) Change subject: vty: Add check against sensible default value for Ny1 ...................................................................... Patch Set 16: (2 comments) File src/osmo-bsc/bts.c: https://gerrit.osmocom.org/c/osmo-bsc/+/30602/comment/fa60d1e6_d68e98eb PS9, Line 1744: unsigned long ny1_recommended = (T3124 + GSM_NY1_REQ_DELTA)/T3105 + 1;
I'm not sure I understand... […] I'm only saying this as a suggestion, in case you are aiming for a clean ceil() instead of a "custom" calculation like floor() + 1.
I'm not sure what's the correct formula, but the comment sounds like you wanted a rounded up integer division, as in ceil((float)(T3124 + GSM_NY1_REQ_DELTA) / T3105) if that is true then the correct integer division here is (T3124 + GSM_NY1_REQ_DELTA + (T3105-1)) / T3105 (like in OSMO_BYTES_FOR_BITS() for example) The current patch results in floor((float)(T3124 + GSM_NY1_REQ_DELTA) / T3105) + 1 which is one too many if the numbers work out as a clean division (no fractional part). File src/osmo-bsc/bts.c: https://gerrit.osmocom.org/c/osmo-bsc/+/30602/comment/cc5b2839_0eab2e72 PS14, Line 1738: unsigned long T3105 = osmo_tdef_get(bts->network->T_defs, 3105, OSMO_TDEF_MS, -1);
that was my 'reasoning' as well, didn't see it in our guidelines. […] Maybe this rule is implied by "linux kernel style".
All i know is that code review from day one of submitting osmocom patches asked me to put vars at the top, the reasoning being supposedly compatibility with compilers, and i adopted that (though i personally very much prefer declaring vars at their actual first use) -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/30602 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: If3f96a6bd4f9ae32b6421de43c1c5a5d64482089 Gerrit-Change-Number: 30602 Gerrit-PatchSet: 16 Gerrit-Owner: arehbein <arehbein@sysmocom.de> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> Gerrit-CC: neels <nhofmeyr@sysmocom.de> Gerrit-CC: pespin <pespin@sysmocom.de> Gerrit-Attention: arehbein <arehbein@sysmocom.de> Gerrit-Attention: fixeria <vyanitskiy@sysmocom.de> Gerrit-Attention: pespin <pespin@sysmocom.de> Gerrit-Comment-Date: Tue, 03 Jan 2023 01:12:07 +0000 Gerrit-HasComments: Yes Gerrit-Has-Labels: No Comment-In-Reply-To: arehbein <arehbein@sysmocom.de> Comment-In-Reply-To: neels <nhofmeyr@sysmocom.de> Comment-In-Reply-To: pespin <pespin@sysmocom.de> Gerrit-MessageType: comment