ItemValue
NameSIGNED-INTEGER (spec document BIND SIGNED-INTEGER)
TAG ID0x061L
Codec ID0x00000610
Spec document0x00000000/codecs/0x00000610/ (DECLARE target 0610)
Section3 0011 (Value), offset C within the section = 1
KindValue · family: NUMERIC
TAG WORD0000 0110 0001 LLLL (000K KKKC CCCC LLLL)
Index descriptionMinimum-WORD two’s complement signed integer
Hugo sidevalue/numeric/signed-integer.md

Fields (spec document)

The order of FIELDs in the document is the order of the Payload fields (Codec spec document).

OrderField (BIND)FIELDWidthReceiving format (CODEC)ENUM
1integer#2remaining raw value (0xFFFF)

SIGNED-INTEGER is a Value that represents a signed integer. Its direct Value code is 0x061L, family NUMERIC. The whole Payload is read as an arbitrary-precision two’s complement integer in big-endian WORD order. The Payload is at least 1 WORD, and only the minimum-WORD canonical representation is allowed.

Layout

TAG WORD          0000 0110 0001 LLLL      Codec 0x061L
[Length extension TAG] when the total is 15 WORD or more
Payload WORD 1st  (high WORD)   Integer 1st
...
Payload WORD Nth  (low WORD)    Integer Nth

Interpretation

  • The most significant bit of the first Payload WORD is the sign bit of the whole integer.
  • All Payload WORDs are read as one continuous two’s complement bit string. The first WORD is the highest place and the last WORD is the lowest.
  • If the Payload is N WORD, the interpretation width is 16N bit. This width is not a declared storage width but the representation width of the value determined by the canonical form.
  • There is no Byte Count or bit width descriptor.

Canonical form

  • 0 is the 1 WORD Payload 0000.
  • Leading sign-extension WORDs that do not change the value are forbidden.
  • When the Payload is 2 WORD or more, the following are non-canonical.
    • The first WORD is 0000 and the most significant bit of the next WORD is 0
    • The first WORD is FFFF and the most significant bit of the next WORD is 1
  • A leading 0000 that preserves the sign of a positive number is allowed when the most significant bit of the next WORD is 1.
  • A leading FFFF that preserves the sign of a negative number is allowed when the most significant bit of the next WORD is 0.
  • A decoder must reject a non-canonical representation.

Length

  • The total is the WORD count of the TAG 1 WORD, the Length extension TAG (if any), and the Payload. Up to 14 WORD uses the direct length, and 15 WORD or more uses the 1110/1111 extended length; the extension TAG is also counted in the total (Record and TAG WORD).
  • A declared width such as INT8, INT16, or INT32 is not preserved; only the numeric value is. -32768 to 32767 is 1 WORD, and outside that range as many WORDs as needed are added. There is no separate SIGNED-INT8 format.

Examples

ValuePayload WORDVerdict
00000canonical
10001canonical
327677FFFcanonical
327680000 8000canonical: 0000 is needed to preserve the positive sign
-1FFFFcanonical
-327688000canonical
-32769FFFF 7FFFcanonical: FFFF is needed to preserve the negative sign
10000 0001non-canonical: unnecessary leading 0000
-1FFFF FFFFnon-canonical: unnecessary leading FFFF

Format status

  • Two’s complement is a widely used convention, but this representation, which normalizes an arbitrary-precision value into a sequence of minimum 16-bit WORDs and binds it to a GEUL TAG, is a GEUL-specific scalar profile.
  • Exchanging values with fixed-width external types such as INT8/16/32/64 requires a range check and an explicit width conversion.

Spec document source

This is the spec document 0x00000000/codecs/0x00000610/latest.geul as read with geul show (hexadecimal in uppercase).

SPEC-VERSION 0x0001
DOC-ID 0x0426000000000000061000000000
BODY
#1 DECLARE 0x0610
#2 FIELD #1 rest
#3 BIND #1 "SIGNED-INTEGER"
#4 BIND #2 "integer"