[trunk] Fix a warning about type conversion. Use a trick where unsigned wrapping is legal

This commit is contained in:
Mathieu Malaterre 2014-02-24 08:52:44 +00:00
parent e826e9281e
commit 33d8f08964
1 changed files with 4 additions and 4 deletions

View File

@ -146,17 +146,17 @@ void opj_bio_init_dec(opj_bio_t *bio, OPJ_BYTE *bp, OPJ_UINT32 len) {
}
void opj_bio_write(opj_bio_t *bio, OPJ_UINT32 v, OPJ_UINT32 n) {
OPJ_INT32 i;
for (i = n - 1; i >= 0; i--) {
OPJ_UINT32 i;
for (i = n - 1; i < n; i--) {
opj_bio_putbit(bio, (v >> i) & 1);
}
}
OPJ_UINT32 opj_bio_read(opj_bio_t *bio, OPJ_UINT32 n) {
OPJ_INT32 i;
OPJ_UINT32 i;
OPJ_UINT32 v;
v = 0;
for (i = n - 1; i >= 0; i--) {
for (i = n - 1; i < n; i--) {
v += opj_bio_getbit(bio) << i;
}
return v;