Mercurial > libavutil.hg
changeset 992:a13125b5be3a libavutil
bswap: change ME to NE in macro names
Other parts of FFmpeg use NE (native endian) rather than ME (machine).
This makes it consistent.
author | mru |
---|---|
date | Sat, 10 Jul 2010 22:09:01 +0000 |
parents | ac42d0f16eae |
children | f8db9a2bae05 |
files | bswap.h crc.c des.c md5.c sha.c |
diffstat | 5 files changed, 34 insertions(+), 34 deletions(-) [+] |
line wrap: on
line diff
--- a/bswap.h Sat Jul 10 00:40:59 2010 +0000 +++ b/bswap.h Sat Jul 10 22:09:01 2010 +0000 @@ -85,34 +85,34 @@ } #endif -// be2me ... big-endian to machine-endian -// le2me ... little-endian to machine-endian +// be2ne ... big-endian to native-endian +// le2ne ... little-endian to native-endian #if HAVE_BIGENDIAN -#define be2me_16(x) (x) -#define be2me_32(x) (x) -#define be2me_64(x) (x) -#define le2me_16(x) bswap_16(x) -#define le2me_32(x) bswap_32(x) -#define le2me_64(x) bswap_64(x) -#define AV_BE2MEC(s, x) (x) -#define AV_LE2MEC(s, x) AV_BSWAPC(s, x) +#define be2ne_16(x) (x) +#define be2ne_32(x) (x) +#define be2ne_64(x) (x) +#define le2ne_16(x) bswap_16(x) +#define le2ne_32(x) bswap_32(x) +#define le2ne_64(x) bswap_64(x) +#define AV_BE2NEC(s, x) (x) +#define AV_LE2NEC(s, x) AV_BSWAPC(s, x) #else -#define be2me_16(x) bswap_16(x) -#define be2me_32(x) bswap_32(x) -#define be2me_64(x) bswap_64(x) -#define le2me_16(x) (x) -#define le2me_32(x) (x) -#define le2me_64(x) (x) -#define AV_BE2MEC(s, x) AV_BSWAPC(s, x) -#define AV_LE2MEC(s, x) (x) +#define be2ne_16(x) bswap_16(x) +#define be2ne_32(x) bswap_32(x) +#define be2ne_64(x) bswap_64(x) +#define le2ne_16(x) (x) +#define le2ne_32(x) (x) +#define le2ne_64(x) (x) +#define AV_BE2NEC(s, x) AV_BSWAPC(s, x) +#define AV_LE2NEC(s, x) (x) #endif -#define AV_BE2ME16C(x) AV_BE2MEC(16, x) -#define AV_BE2ME32C(x) AV_BE2MEC(32, x) -#define AV_BE2ME64C(x) AV_BE2MEC(64, x) -#define AV_LE2ME16C(x) AV_LE2MEC(16, x) -#define AV_LE2ME32C(x) AV_LE2MEC(32, x) -#define AV_LE2ME64C(x) AV_LE2MEC(64, x) +#define AV_BE2NE16C(x) AV_BE2NEC(16, x) +#define AV_BE2NE32C(x) AV_BE2NEC(32, x) +#define AV_BE2NE64C(x) AV_BE2NEC(64, x) +#define AV_LE2NE16C(x) AV_LE2NEC(16, x) +#define AV_LE2NE32C(x) AV_LE2NEC(32, x) +#define AV_LE2NE64C(x) AV_LE2NEC(64, x) #endif /* AVUTIL_BSWAP_H */
--- a/crc.c Sat Jul 10 00:40:59 2010 +0000 +++ b/crc.c Sat Jul 10 22:09:01 2010 +0000 @@ -121,7 +121,7 @@ crc = ctx[((uint8_t)crc) ^ *buffer++] ^ (crc >> 8); while(buffer<end-3){ - crc ^= le2me_32(*(const uint32_t*)buffer); buffer+=4; + crc ^= le2ne_32(*(const uint32_t*)buffer); buffer+=4; crc = ctx[3*256 + ( crc &0xFF)] ^ctx[2*256 + ((crc>>8 )&0xFF)] ^ctx[1*256 + ((crc>>16)&0xFF)]
--- a/des.c Sat Jul 10 00:40:59 2010 +0000 +++ b/des.c Sat Jul 10 22:09:01 2010 +0000 @@ -297,10 +297,10 @@ } void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt) { - uint64_t iv_val = iv ? be2me_64(*(uint64_t *)iv) : 0; + uint64_t iv_val = iv ? be2ne_64(*(uint64_t *)iv) : 0; while (count-- > 0) { uint64_t dst_val; - uint64_t src_val = src ? be2me_64(*(const uint64_t *)src) : 0; + uint64_t src_val = src ? be2ne_64(*(const uint64_t *)src) : 0; if (decrypt) { uint64_t tmp = src_val; if (d->triple_des) { @@ -317,12 +317,12 @@ } iv_val = iv ? dst_val : 0; } - *(uint64_t *)dst = be2me_64(dst_val); + *(uint64_t *)dst = be2ne_64(dst_val); src += 8; dst += 8; } if (iv) - *(uint64_t *)iv = be2me_64(iv_val); + *(uint64_t *)iv = be2ne_64(iv_val); } #ifdef TEST
--- a/md5.c Sat Jul 10 00:40:59 2010 +0000 +++ b/md5.c Sat Jul 10 22:09:01 2010 +0000 @@ -141,7 +141,7 @@ void av_md5_final(AVMD5 *ctx, uint8_t *dst){ int i; - uint64_t finalcount= le2me_64(ctx->len<<3); + uint64_t finalcount= le2ne_64(ctx->len<<3); av_md5_update(ctx, "\200", 1); while((ctx->len & 63)!=56) @@ -150,7 +150,7 @@ av_md5_update(ctx, (uint8_t*)&finalcount, 8); for(i=0; i<4; i++) - ((uint32_t*)dst)[i]= le2me_32(ctx->ABCD[3-i]); + ((uint32_t*)dst)[i]= le2ne_32(ctx->ABCD[3-i]); } void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len){
--- a/sha.c Sat Jul 10 00:40:59 2010 +0000 +++ b/sha.c Sat Jul 10 22:09:01 2010 +0000 @@ -43,7 +43,7 @@ #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ -#define blk0(i) (block[i] = be2me_32(((const uint32_t*)buffer)[i])) +#define blk0(i) (block[i] = be2ne_32(((const uint32_t*)buffer)[i])) #define blk(i) (block[i] = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1)) #define R0(v,w,x,y,z,i) z += ((w&(x^y))^y) + blk0(i) + 0x5A827999 + rol(v, 5); w = rol(w, 30); @@ -68,7 +68,7 @@ for (i = 0; i < 80; i++) { int t; if (i < 16) - t = be2me_32(((uint32_t*)buffer)[i]); + t = be2ne_32(((uint32_t*)buffer)[i]); else t = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1); block[i] = t; @@ -314,7 +314,7 @@ void av_sha_final(AVSHA* ctx, uint8_t *digest) { int i; - uint64_t finalcount = be2me_64(ctx->count << 3); + uint64_t finalcount = be2ne_64(ctx->count << 3); av_sha_update(ctx, "\200", 1); while ((ctx->count & 63) != 56)