Roy Marples
2014-07-05 21:48:04 UTC
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
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
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
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de