From 1614a88cb7bc341888cb304541979ab0cd0475c4 Mon Sep 17 00:00:00 2001 From: rmalizia44 Date: Mon, 26 Dec 2022 20:12:54 -0300 Subject: [PATCH] Add code block in boxing docs to better spacing --- doc/internal/boxing.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/doc/internal/boxing.md b/doc/internal/boxing.md index 3e01d76bf..a16ce8a15 100644 --- a/doc/internal/boxing.md +++ b/doc/internal/boxing.md @@ -14,15 +14,15 @@ Some values (called immediate values, e.g. integers, booleans, symbols, etc.) ar The Word boxing packing bit patterns are like following: -| Types | Bit Pattern | -|--------|-------------------------------------| -| object | xxxxxxxx xxxxxxxx xxxxxxxx xxxxx000 | -| fixnum | xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxx1 | -| nil | 00000000 00000000 00000000 00000000 | -| true | 00000000 00000000 00000000 00001100 | -| false | 00000000 00000000 00000000 00000100 | -| undef | 00000000 00000000 00000000 00010100 | -| symbol | xxxxxxxx xxxxxxxx xxxxxxxx xxxxxx10 | +| Types | Bit Pattern | +|--------|---------------------------------------| +| object | `xxxxxxxx xxxxxxxx xxxxxxxx xxxxx000` | +| fixnum | `xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxx1` | +| nil | `00000000 00000000 00000000 00000000` | +| true | `00000000 00000000 00000000 00001100` | +| false | `00000000 00000000 00000000 00000100` | +| undef | `00000000 00000000 00000000 00010100` | +| symbol | `xxxxxxxx xxxxxxxx xxxxxxxx xxxxxx10` | On 64 bit platform (unless `MRB_WORDBOX_NO_FLOAT_TRUNCATE`), float values are also packed in the `mrb_value`. In that case, we drop least significant 2 bits from mantissa. If you need full precision for floating-point numbers, define `MRB_WORDBOX_NO_FLOAT_TRUNCATE`. @@ -33,17 +33,17 @@ NaN boxing packs the Ruby data in a floating-point numbers, which represent NaN The NaN boxing packing bit patterns are like following: -| Types | Bit Pattern | -|--------|-------------------------------------------------------------------------| -| float | SEEEEEEE EEEEFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF | -| +/-inf | S1111111 11110000 00000000 00000000 00000000 00000000 00000000 00000000 | -| nan | 01111111 11111000 00000000 00000000 00000000 00000000 00000000 00000000 | -| fixnum | 01111111 11111001 00000000 00000000 IIIIIIII IIIIIIII IIIIIIII IIIIIIII | -| symbol | 01111111 11111110 00000000 00000000 SSSSSSSS SSSSSSSS SSSSSSSS SSSSSSSS | -| misc | 01111111 11111111 00000000 00000000 00000000 00000000 00TTTTTT 0000MMMM | -| object | 01111111 11111100 PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPP00 | -| ptr | 01111111 11111100 PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPP01 | -| nil | 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 | +| Types | Bit Pattern | +|--------|---------------------------------------------------------------------------| +| float | `SEEEEEEE EEEEFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF` | +| +/-inf | `S1111111 11110000 00000000 00000000 00000000 00000000 00000000 00000000` | +| nan | `01111111 11111000 00000000 00000000 00000000 00000000 00000000 00000000` | +| fixnum | `01111111 11111001 00000000 00000000 IIIIIIII IIIIIIII IIIIIIII IIIIIIII` | +| symbol | `01111111 11111110 00000000 00000000 SSSSSSSS SSSSSSSS SSSSSSSS SSSSSSSS` | +| misc | `01111111 11111111 00000000 00000000 00000000 00000000 00TTTTTT 0000MMMM` | +| object | `01111111 11111100 PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPP00` | +| ptr | `01111111 11111100 PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPPPP PPPPPP01` | +| nil | `00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000` | The object values appear far more frequently than floating-point numbers, so we offset the value so that object pointers are unchanged. This technique is called "favor pointer"".