Commit d13b162a authored by Raphael Riebl's avatar Raphael Riebl

per_support: use uintmax_t in uper_get_constrained_whole_number function

parent 84f1fbb9
...@@ -121,9 +121,9 @@ uper_put_nsnnwn(asn_per_outp_t *po, int n) { ...@@ -121,9 +121,9 @@ uper_put_nsnnwn(asn_per_outp_t *po, int n) {
/* X.691-2008/11, #11.5.6 -> #11.3 */ /* X.691-2008/11, #11.5.6 -> #11.3 */
int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *out_value, int nbits) { int uper_get_constrained_whole_number(asn_per_data_t *pd, uintmax_t *out_value, int nbits) {
unsigned long lhalf; /* Lower half of the number*/ uintmax_t lhalf; /* Lower half of the number*/
long half; intmax_t half;
if(nbits <= 31) { if(nbits <= 31) {
half = per_get_few_bits(pd, nbits); half = per_get_few_bits(pd, nbits);
...@@ -141,7 +141,7 @@ int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *out_val ...@@ -141,7 +141,7 @@ int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *out_val
if(uper_get_constrained_whole_number(pd, &lhalf, nbits - 31)) if(uper_get_constrained_whole_number(pd, &lhalf, nbits - 31))
return -1; return -1;
*out_value = ((unsigned long)half << (nbits - 31)) | lhalf; *out_value = ((uintmax_t)half << (nbits - 31)) | lhalf;
return 0; return 0;
} }
......
...@@ -64,7 +64,7 @@ ssize_t uper_get_nsnnwn(asn_per_data_t *pd); ...@@ -64,7 +64,7 @@ ssize_t uper_get_nsnnwn(asn_per_data_t *pd);
ssize_t aper_get_nsnnwn(asn_per_data_t *pd, int range); ssize_t aper_get_nsnnwn(asn_per_data_t *pd, int range);
/* X.691-2008/11, #11.5.6 */ /* X.691-2008/11, #11.5.6 */
int uper_get_constrained_whole_number(asn_per_data_t *pd, unsigned long *v, int nbits); int uper_get_constrained_whole_number(asn_per_data_t *pd, uintmax_t *v, int nbits);
/* Temporary compatibility layer. Will get removed. */ /* Temporary compatibility layer. Will get removed. */
......
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