Re: [PATCH BlueZ] mesh: Correctly generate NetKey list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/09, Stotland, Inga wrote:
>> Please don't use bit shifts for division.
> Why?

Because it's a different operation, and is less readable.  It's a
formula, so use math operators for numbers and bit operators for bits.

For example, idx_pair <<= 12 is fine, because the *context* is
bit-packing. Noone sane would write this as idx_pair *= 4096. This
reasoning applies the other way as well: don't write foo >> 2 where you
mean foo / 4.

>> Also, I think it's clearer to write this as:
>>     req_size = num_keys * 3 - num_keys % 2
>
> No, this is not how I read the spec. We need to pack 2 key indices in 3 octets.
> For example, 4 keys are packed in 6 octets and 5 keys are packed in 8 octets.

Yes, you're right. Sorry.

-- 
Michał Lowas-Rzechonek <michal.lowas-rzechonek@xxxxxxxxxxx>
Silvair http://silvair.com
Jasnogórska 44, 31-358 Krakow, POLAND



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux