How to compare two ipv6 addresses on a little endian machine in C -


i trying compare 2 ipv6 addresses want create code portable. know ipv6 addresses stored in network byte order (big endian) on big-endian cpu can use memcmp across 2 in6_addr structs. easiest way same thing on little-endian machine?

[edit] when want compare 2 addresses want figure out whether address less, equal, or greater other. thought memcmp endian dependent in order scans across bits in memory.

actually, think memcmp work. there's not popular machine 128-bit data type know of. suspect ipv6 address carried around arrays of bytes. given network byte order big-endian, memcmp see , compare high-order byte first, want to.

you right have wondered if machine's endianness matters portability, in case, think doesn't. endianness matters when we're working 16- or 32-bit integers have been copied off network, , want work them integers. here, array of bytes, concern not exist.

i don't -- understand sure i'm doing first -- but, try , see!


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -