# decvalue

This built-in function decodes a value from a bitstring and cuts the consumed part from the bitstring.

- The function return type is integer holding the error code: 0 - decoding was successful, 1 - unspecified cause of decoding failure, 2 - decoding failed because the bitstring did not contained enough bits.
- Decoded value returned through the second (out) argument.
- Type of the second argument has to have an encoding method explicitly set with its atributes.

Related keywords:

- encode
- encvalue

### decvalue( inout bitstring_value, out decoded_value ) return integer;

Example:

type float MyFloat with { encode "RAW" }

var MyFloat f := 1.1;

var bitstring bs := encvalue(f);

var integer i := decvalue(bs, f);

BNF definition of decvalue