Change in libosmocore[master]: bitvec_read_field(): optimize by expanding bytenum_from_bitnum()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

fixeria gerrit-no-reply at lists.osmocom.org
Wed Nov 17 15:06:00 UTC 2021


fixeria has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmocore/+/26309 )

Change subject: bitvec_read_field(): optimize by expanding bytenum_from_bitnum()
......................................................................


Patch Set 1:

(2 comments)

https://gerrit.osmocom.org/c/libosmocore/+/26309/1/src/bitvec.c 
File src/bitvec.c:

https://gerrit.osmocom.org/c/libosmocore/+/26309/1/src/bitvec.c@495 
PS1, Line 495: 		unsigned int bitnum = 7 - (bv->cur_bit % 8);
> Calling it bitnum is confusing here, I'd rather call it bitnum_shift or alike.
This is exactly how it's called in bitvec_get_bit_pos(), and it's clear that the bit number in a byte determines the shift value.


https://gerrit.osmocom.org/c/libosmocore/+/26309/1/src/bitvec.c@497 
PS1, Line 497: 		if (bv->data[bytenum] & (1 << bitnum))
> You could also optimize and get rid of this branch: […]
Are you sure this is going to work? The 'bit' must be either 0 or 1, like the value returned by bitvec_get_bit_pos(). In your proposal the 'bit' might be any value, so it's rather a mask...



-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/26309
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I438fc82d33ab2edbabd4215ec7bc46afb07d50ab
Gerrit-Change-Number: 26309
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-Comment-Date: Wed, 17 Nov 2021 15:06:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: pespin <pespin at sysmocom.de>
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211117/03f8e409/attachment.htm>


More information about the gerrit-log mailing list