mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-03 05:48:42 +03:00
Specify when integers and floats are 32 and when 64 bits (#4893)
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
This commit is contained in:
committed by
Hugo Locurcio
parent
10b7d8411b
commit
cfd9838d32
@@ -17,7 +17,13 @@ Packet specification
|
||||
|
||||
The packet is designed to be always padded to 4 bytes. All values are
|
||||
little-endian-encoded. All packets have a 4-byte header representing an
|
||||
integer, specifying the type of data:
|
||||
integer, specifying the type of data.
|
||||
|
||||
The lowest value two bytes are used to determine the type, while the highest value
|
||||
two bytes contain flags::
|
||||
|
||||
base_type = val & 0xFFFF;
|
||||
flags = val >> 16;
|
||||
|
||||
+--------+--------------------------+
|
||||
| Type | Value |
|
||||
@@ -101,6 +107,17 @@ precision.
|
||||
2: :ref:`int<class_int>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
If no flags are set (flags == 0), the integer is sent as a 32 bit integer:
|
||||
|
||||
+----------+-------+-----------+--------------------------+
|
||||
| Offset | Len | Type | Description |
|
||||
+==========+=======+===========+==========================+
|
||||
| 4 | 4 | Integer | 32-bit signed integer |
|
||||
+----------+-------+-----------+--------------------------+
|
||||
|
||||
If flag ``ENCODE_FLAG_64`` is set (``flags & 1 == 1``), the integer is sent as
|
||||
a 64-bit integer:
|
||||
|
||||
+----------+-------+-----------+--------------------------+
|
||||
| Offset | Len | Type | Description |
|
||||
+==========+=======+===========+==========================+
|
||||
@@ -110,11 +127,22 @@ precision.
|
||||
3: :ref:`float<class_float>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+----------+-------+---------+-------------------------+
|
||||
| Offset | Len | Type | Description |
|
||||
+==========+=======+=========+=========================+
|
||||
| 4 | 4 | Float | IEE 754 32-Bits Float |
|
||||
+----------+-------+---------+-------------------------+
|
||||
If no flags are set (flags == 0), the float is sent as a 32 bit single precision:
|
||||
|
||||
+----------+-------+---------+-----------------------------------+
|
||||
| Offset | Len | Type | Description |
|
||||
+==========+=======+=========+===================================+
|
||||
| 4 | 4 | Float | IEEE 754 single-precision float |
|
||||
+----------+-------+---------+-----------------------------------+
|
||||
|
||||
If flag ``ENCODE_FLAG_64`` is set (``flags & 1 == 1``), the float is sent as
|
||||
a 64-bit double precision number:
|
||||
|
||||
+----------+-------+---------+-----------------------------------+
|
||||
| Offset | Len | Type | Description |
|
||||
+==========+=======+=========+===================================+
|
||||
| 4 | 8 | Float | IEEE 754 double-precision float |
|
||||
+----------+-------+---------+-----------------------------------+
|
||||
|
||||
4: :ref:`String<class_string>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Reference in New Issue
Block a user