svn commit: r261118 - head/sys/dev/usb/wlan

Adrian Chadd adrian.chadd at gmail.com
Fri Jan 24 15:19:07 UTC 2014


On 24 January 2014 07:16, Hans Petter Selasky <hps at bitfrost.no> wrote:
> On 01/24/14 16:11, Adrian Chadd wrote:
>>
>> ... How's that matter?
>>
>> Adrian
>
>
> Ok, read slowly:
>
> uint32_t x = 255U;
> uint8_t y;
>
> On Big endian:
>
> memcpy(&y, &x, 1);
>
> y == 0;
>
> On Little endian:
>
> memcpy(&y, &x, 1);
>
> y == 255;
>
> If I'm not mistaken. The code is wrong because result depends on endianness
> :-)

Right. But that has nothing to do with the memory copy operation. That
has to do with how its stored.

So again - how's memmove() not portable here? :)


-a


More information about the svn-src-head mailing list