tech-net archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Shifting 128 bits
Hi List!
I'm struggling with bit shifting, trying to implement an RFC.
Basically there is code that deals with uint128_t - an IPv6 address.
As I cannot realistically use that in dhcpcd I need something else.
However, this is very much out of my comfort zone and I'm not good at
handling bits!
Here is the code
uint8_t l = 69;
uint128_t p = a_ipv6address;
uint128_t i = p << l;
uint8_t *id = a_buffer;
uint8_t d = a_length;
while (d-- > 0) {
*id++ = i >> 120;
i <<= NBBY;
}
Can anyone help me please?
Thanks
Roy
Home |
Main Index |
Thread Index |
Old Index