| 1 | #cxx . . $ `<file>/terraphast/lib/gcc_clang/intrinsics.hpp`/include <terraces/definitions.hpp>cxx . . $ `<file>/terraphast/include/terraces/definitions.hpp`/ |
| 2 | |
| 3 | namespace terracescxx . . $ terraces/ { |
| 4 | namespace bitscxx . . $ terraces/bits/ { |
| 5 | |
| 6 | inline indexcxx . . $ terraces/index# popcountcxx . . $ terraces/bits/popcount(ecdaa1632f49f591).(indexcxx . . $ terraces/index# word) { return indexcxx . . $ terraces/index#(__builtin_popcountll(word)); } |
| 7 | |
| 8 | inline indexcxx . . $ terraces/index# bitscancxx . . $ terraces/bits/bitscan(ecdaa1632f49f591).(indexcxx . . $ terraces/index# word) { return indexcxx . . $ terraces/index#(__builtin_ctzll(word)); } |
| 9 | |
| 10 | static_assert(sizeof(long long) >= sizeof(indexcxx . . $ terraces/index#), "intrinsic word sizes incompatible"); |
| 11 | |
| 12 | inline indexcxx . . $ terraces/index# rbitscancxx . . $ terraces/bits/rbitscan(ecdaa1632f49f591).(indexcxx . . $ terraces/index# word) { |
| 13 | return indexcxx . . $ terraces/index#(stdcxx . . $ std/::numeric_limitscxx . . $ std/numeric_limits#<long long>::digitscxx . . $ std/numeric_limits#digits. - __builtin_clzll(word)); |
| 14 | } |
| 15 | |
| 16 | inline bool add_overflowcxx . . $ terraces/bits/add_overflow(ebf33cdf18a0e95a).(indexcxx . . $ terraces/index# a, indexcxx . . $ terraces/index# b, indexcxx . . $ terraces/index#& result) { |
| 17 | return __builtin_add_overflow(a, b, &result); |
| 18 | } |
| 19 | |
| 20 | inline bool mul_overflowcxx . . $ terraces/bits/mul_overflow(ebf33cdf18a0e95a).(indexcxx . . $ terraces/index# a, indexcxx . . $ terraces/index# b, indexcxx . . $ terraces/index#& result) { |
| 21 | return __builtin_mul_overflow(a, b, &result); |
| 22 | } |
| 23 | |
| 24 | } // namespace bits |
| 25 | } // namespace terraces |