X-Git-Url: https://git.distorted.org.uk/~mdw/secnet/blobdiff_plain/c215a4bc817daf7b5631236c3c7b6a509479b034..refs/heads/mdw/xdh:/unaligned.h diff --git a/unaligned.h b/unaligned.h index bce0e5f..6f4f163 100644 --- a/unaligned.h +++ b/unaligned.h @@ -4,7 +4,7 @@ * * secnet is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version d of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * secnet is distributed in the hope that it will be useful, but @@ -31,6 +31,9 @@ #define put_uint32(a,v) do { (a)[0]=(v)>>24; (a)[1]=((v)&0xff0000)>>16; \ (a)[2]=((v)&0xff00)>>8; (a)[3]=(v)&0xff; } while(0) +#define put_uint32_le(a, v) do { (a)[0]=(v)&0xff; (a)[1]=((v)&0xff00)>>8; \ +(a)[2]=((v)&0xff0000)>>16; (a)[3]=(v)>>24; } while(0) + #define put_uint16(a,v) do {(a)[0]=((v)&0xff00)>>8; (a)[1]=(v)&0xff;} while(0) #define put_uint8(a,v) do {(a)[0]=((v)&0xff);} while(0) @@ -39,6 +42,10 @@ (((uint32_t)(a)[0]<<24) | ((uint32_t)(a)[1]<<16) | \ ((uint32_t)(a)[2]<<8) | (uint32_t)(a)[3]) +#define get_uint32_le(a) \ + (((uint32_t)(a)[0]) | ((uint32_t)(a)[1]<<8) | \ + ((uint32_t)(a)[2]<<16) | (uint32_t)(a)[3]<<24) + #define get_uint16(a) (((uint16_t)(a)[0]<<8)|(uint16_t)(a)[1]) #define get_uint8(a) (((uint8_t)(a)[0]))