morphisms: fix bitshift in lenpfx to msb-cont

This commit is contained in:
Michael Sippel 2025-05-10 17:53:31 +02:00
parent 6f0a0f5927
commit ea2504ff07
Signed by: senvas
GPG key ID: F96CF119C34B64A6

View file

@ -29,13 +29,13 @@ morph_array_as_lenpfx_to_continuation_bit (T:Type)
```
for( uint64_t i = 0; i < src->len; ++i ) {
const size_t n_bits = 8*sizeof(T);
if( src->items[i] & (1<<(n_bits-1)) ) {
fprintf(stderr, "error: value to high for MsbContinuation\n");
if( src->items[i] & ((uint64_t)1<<(n_bits-1)) ) {
fprintf(stderr, "error: value has MSB set, while being used in MsbContinuation sequence!\n");
return -1;
}
dst[i] = src->items[i];
if( i+1 < src->len )
dst[i] |= (1<<(n_bits-1));
dst[i] |= ((uint64_t)1<<(n_bits-1));
}
```