| 132 | |
| 133 | template <class INT> |
| 134 | void ValueSlot::setInt(INT i) { |
| 135 | // In the following, int64_t(i) is to avoid compiler warning against comparision between unsigned and signed. |
| 136 | // If INT is unsigned, int64_t(i) won't be executed, that is, we won't actually convert uint64 to int64. |
| 137 | // We also assume the largest int representation is 64-bit. |
| 138 | if (i < 2048 && (!numeric_limits<INT>::is_signed || int64_t(i) > -2048)) { |
| 139 | setInline(kShortIntTag, (i >> 8) & 0x0F); |
| 140 | _inlineVal[1] = (uint8_t)(i & 0xFF); |
| 141 | } else { |
| 142 | uint8_t buf[8]; |
| 143 | auto size = PutIntOfLength(buf, i, !numeric_limits<INT>::is_signed); |
| 144 | setValue(kIntTag, |
| 145 | (int)(size-1) | (numeric_limits<INT>::is_signed ? 0 : 0x08), |
| 146 | {buf, size}); |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | |
| 151 | void ValueSlot::set(float f) { |
nothing calls this directly
no test coverage detected