> I need some clarification of PER encoding of constrained whole
> number. The ITU-T spec X.691 section 10.5 explains that for ALIGNED
> mode, when the range is exactly 256, the value would be encoded in one
> octet and it would be octet aligned. 256 is a 9 bit value, so how is it
> encoded in one octet.
The difficulty seems to be your understanding of range. Range simply means
the set of possible values from smallest to largest. If we were to
constrain the set to (0..3), there are four values in the range. If we
were to say (0..255), there are 256 values in the range. Also 256 values
for (1..256) or (999..1254) or (-128..127). Under such circumstances, we
do not encode the value itself but a transformed value, mapping the actual
value to the encoded value.
By way of example, if we have an INTEGER constrained as (1..256), the map
would be
1 encodes as an unsigned 0
2 encodes as an unsigned 1
.
.
.
256 encodes as an unsigned 255
As another example, if we have an INTEGER constrained as (999..1254), the
map would be
999 encodes as an unsigned 0
1000 encodes as an unsigned 1
.
.
.
1254 encodes as an unsigned 255
And finally, if we have an INTEGER constrained as (-128..127), the map
would be
-128 encodes as an unsigned 0
-127 encodes as an unsigned 1
.
.
.
+127 encodes as an unsigned 255
> ......................Supposing that its somehow encoded in one octet,
> if the generated bit stream is not octet aligned but say taking up 2.1
> bytes(decimal representing the bits) then after encoding of the value
> would it totally use 4 bytes? Kindly advice. Thanking you.
It's not clear what you mean, but I'll guess you mean that your current
encoded data buffer contains 17 bits and you need to append to it an
aligned 8-bit value. If that's the case, we would align the 8-bit value by
zero-padding the 17 bits to 24 bits and then appending the aligned 8-bit
value.
I hope I answered the question. If not, please try rephrasing it.
=====================================================================
Conrad Sigona Voice Mail : 1-732-302-9669 x400
OSS Nokalva Fax : 1-419-831-5035
[EMAIL PROTECTED] My direct line : 1-315-845-1773