Commit deedbc37 authored by Raphael Riebl's avatar Raphael Riebl Committed by Mouse

uper: fix encoding of constrained integers

On 32bit architectures the MSBs were truncated
parent 9ee68e63
...@@ -148,7 +148,7 @@ int uper_get_constrained_whole_number(asn_per_data_t *pd, uintmax_t *out_value, ...@@ -148,7 +148,7 @@ int uper_get_constrained_whole_number(asn_per_data_t *pd, uintmax_t *out_value,
/* X.691-2008/11, #11.5.6 -> #11.3 */ /* X.691-2008/11, #11.5.6 -> #11.3 */
int int
uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, uper_put_constrained_whole_number_u(asn_per_outp_t *po, uintmax_t v,
int nbits) { int nbits) {
if(nbits <= 31) { if(nbits <= 31) {
return per_put_few_bits(po, v, nbits); return per_put_few_bits(po, v, nbits);
......
...@@ -46,7 +46,7 @@ int per_long_range_unrebase(unsigned long inp, intmax_t lb, intmax_t ub, long *o ...@@ -46,7 +46,7 @@ int per_long_range_unrebase(unsigned long inp, intmax_t lb, intmax_t ub, long *o
int per_imax_range_unrebase(uintmax_t inp, intmax_t lb, intmax_t ub, intmax_t *outp); int per_imax_range_unrebase(uintmax_t inp, intmax_t lb, intmax_t ub, intmax_t *outp);
/* X.691-2008/11, #11.5 */ /* X.691-2008/11, #11.5 */
int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits); int uper_put_constrained_whole_number_u(asn_per_outp_t *po, uintmax_t v, int nbits);
/* /*
* X.691 (08/2015) #11.9 "General rules for encoding a length determinant" * X.691 (08/2015) #11.9 "General rules for encoding a length determinant"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment