**status**: open --> closed-fixed**milestone**: -->

With trunk/rev 1405 (-fnative-types NOT set)

I tried this definition of an 32 bit unsigned int:

SequenceNumber ::= [PRIVATE 4] IMPLICIT INTEGER (0..4294967295)

Despite the workaround in INTEGER_encoded_uper():

if(ct->range_bits == 32) {

/* TODO: extend to >32 bits */

long v = value - ct->lower_bound;

if(per_put_few_bits(po, v >> 1, 31)

|| per_put_few_bits(po, v, 1))

_ASN_ENCODE_FAILED;

} else {

the encoded PER cannot be decoded.

SequenceNumber ::= [PRIVATE 4] IMPLICIT INTEGER (0..2147483647)

...,that is range 31 bits, but this did not work either!

So I changed the workaround in INTEGER_encoded_uper():

if(ct->range_bits == 32) {

/* TODO: extend to >32 bits */

long v = value - ct->lower_bound;

if(per_put_few_bits(po, v >> 16, 16)

|| per_put_few_bits(po, v, 16))

_ASN_ENCODE_FAILED;

} else {

...,that is, split the 32 bits into 16 + 16 instead of 31 + 1. This seems to work for the 32 bit range int - the encoded PDU is correctly.

So there seems to be a bug in per_put_few_bits()?

/Matthias

matthias.bolz AT siemens DOT com