Sets the bits from MSB to LSB of the significand part of a float. For example 0 would set the bit 23 (counting from LSB to MSB), and 1 would set the 22nd bit.
| 687 | // For example 0 would set the bit 23 (counting from LSB to MSB), |
| 688 | // and 1 would set the 22nd bit. |
| 689 | uint32_t bits_set(const std::vector<uint32_t>& bits) { |
| 690 | const uint32_t top_bit = 1u << 22u; |
| 691 | uint32_t val = 0; |
| 692 | for (uint32_t i : bits) { |
| 693 | val |= top_bit >> i; |
| 694 | } |
| 695 | return val; |
| 696 | } |
| 697 | |
| 698 | // The same as bits_set but for a Float16 value instead of 32-bit floating |
| 699 | // point. |