Data Types: Difference between revisions
From RuneWiki
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
== | == Nomenclature == | ||
=== Endianness === | |||
(none) - big (DCBA) | |||
i - "inverse" (little) (ABCD) | |||
m - "middle" (CDAB) - not an authentic name, no clue on original | |||
im - "inverse-middle" (reverse) (BADC) - not an authentic name, jagex may call this "_alt3" | |||
=== Operations === | |||
g - get | |||
p - put | |||
=== Types === | |||
number of bytes - fixed size | |||
smart - 0 to 32768 (unsigned), -16384 to +16383 (signed) | |||
float - standard 32-bit floating point number | |||
jstr - NUL-terminated / Newline-terminated (depending on revision) string | |||
jstr2 - version-prefixed jstr (unused) | |||
data - raw data (size known ahead of time/elsewhere) | |||
VarSmart - variable-length smart | |||
VarInt - variable-length int | |||
VarLong - variable-length long | |||
=== Signedness === | |||
(none) - unsigned, depending on exact circumstances with Java's int/long implementation | |||
signed - explicitly signed, allowed to overflow | |||
=== Transformation === | |||
(none) - no change | |||
add - add 128 to the lowest byte | |||
sub - subtract lowest byte from 128 | |||
neg - negate, only used on byte types | |||
== | == Operation Table == | ||
{| class="wikitable" | {| class="wikitable" | ||
!Operation | !Operation | ||
!Description | |||
|- | |- | ||
| | |p1 | ||
|byte | |Writes a single byte (8-bits). | ||
|- | |- | ||
| | |p2 | ||
| | |Writes a short (2 bytes / 16-bits). | ||
|- | |- | ||
| | |p3 | ||
| | |Writes a medium (3 bytes / 24-bits). | ||
|- | |- | ||
| | |p4 | ||
| | |Writes an int (4 bytes / 32-bits). | ||
|- | |- | ||
| | |p8 | ||
| | |Writes a long (8 bytes / 64-bits). | ||
|- | |- | ||
| | |pjstr | ||
| | |Writes a string. | ||
|} | |} | ||
Revision as of 12:53, 7 June 2023
Nomenclature
Endianness
(none) - big (DCBA)
i - "inverse" (little) (ABCD)
m - "middle" (CDAB) - not an authentic name, no clue on original
im - "inverse-middle" (reverse) (BADC) - not an authentic name, jagex may call this "_alt3"
Operations
g - get
p - put
Types
number of bytes - fixed size
smart - 0 to 32768 (unsigned), -16384 to +16383 (signed)
float - standard 32-bit floating point number
jstr - NUL-terminated / Newline-terminated (depending on revision) string
jstr2 - version-prefixed jstr (unused)
data - raw data (size known ahead of time/elsewhere)
VarSmart - variable-length smart
VarInt - variable-length int
VarLong - variable-length long
Signedness
(none) - unsigned, depending on exact circumstances with Java's int/long implementation
signed - explicitly signed, allowed to overflow
Transformation
(none) - no change
add - add 128 to the lowest byte
sub - subtract lowest byte from 128
neg - negate, only used on byte types
Operation Table
Operation | Description |
---|---|
p1 | Writes a single byte (8-bits). |
p2 | Writes a short (2 bytes / 16-bits). |
p3 | Writes a medium (3 bytes / 24-bits). |
p4 | Writes an int (4 bytes / 32-bits). |
p8 | Writes a long (8 bytes / 64-bits). |
pjstr | Writes a string. |