codelength.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef __CODELENGTH_H__
00008 #define __CODELENGTH_H__
00009
00010
00011
00012
00013 #define DECODELENGTH(n, p) n = 0; \
00014 do { n = (n << 7) | (*p & 0x7f); } \
00015 while(*(p++)&0x80);
00016
00017 #define CODELENGTH(n, p) if(n>=268435456) *(p++) = (n >> 28) | 0x80; \
00018 if(n>=2097152) *(p++) = (n >> 21) | 0x80; \
00019 if(n>=16384) *(p++) = (n >> 14) | 0x80; \
00020 if(n>=128) *(p++) = (n >> 7) | 0x80; \
00021 *(p++) = n & 0x7f;
00022
00023 #endif
00024