2 * Copyright (c) 2017 Lev Walkin <vlm@lionet.info>.
4 * Redistribution and modifications are permitted subject to BSD license.
6 #include <asn_internal.h>
10 BOOLEAN_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, const asn_TYPE_descriptor_t *td,
11 const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
13 BOOLEAN_t *st = (BOOLEAN_t *)*sptr;
20 st = (BOOLEAN_t *)(*sptr = MALLOC(sizeof(*st)));
21 if(!st) ASN__DECODE_FAILED;
25 * Extract a single bit
27 switch(per_get_few_bits(pd, 1)) {
39 ASN_DEBUG("%s decoded as %s", td->name, *st ? "TRUE" : "FALSE");
47 BOOLEAN_encode_aper(const asn_TYPE_descriptor_t *td,
48 const asn_per_constraints_t *constraints,
49 const void *sptr, asn_per_outp_t *po) {
50 const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
51 asn_enc_rval_t er = { 0, 0, 0 };
55 if(!st) ASN__ENCODE_FAILED;
57 if(per_put_few_bits(po, *st ? 1 : 0, 1))