-typedef struct asn_per_outp_s {
- uint8_t *buffer; /* Pointer into the (tmpspace) */
- size_t nboff; /* Bit offset to the meaningful bit */
- size_t nbits; /* Number of bits left in (tmpspace) */
- uint8_t tmpspace[32]; /* Preliminary storage to hold data */
- int (*outper)(const void *data, size_t size, void *op_key);
- void *op_key; /* Key for (outper) data callback */
- size_t flushed_bytes; /* Bytes already flushed through (outper) */
-} asn_per_outp_t;
-
-/* Output a small number of bits (<= 31) */
-int per_put_few_bits(asn_per_outp_t *per_data, uint32_t bits, int obits);
-
-/* Output a large number of bits */
-int per_put_many_bits(asn_per_outp_t *po, const uint8_t *src, int put_nbits);
+int per_long_range_rebase(long v, long lb, long ub, unsigned long *output);
+/* The inverse operation: restores the value by the offset and its bounds. */
+int per_long_range_unrebase(unsigned long inp, long lb, long ub, long *outp);
+
+/* X.691-2008/11, #11.5 */
+int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits);