Skip to content

Commit d3b10a8

Browse files
committed
Update bazel overlay and remove debugging assertions.
1 parent 335c918 commit d3b10a8

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

libc/src/__support/fixed_point/fx_bits.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,28 @@ template <typename T>
2626
LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_fixed_point_v<T>, T>
2727
bit_and(T x, T y) {
2828
using BitType = typename FXRep<T>::StorageType;
29-
static_assert(sizeof(BitType) * CHAR_BIT == sizeof(T) * CHAR_BIT);
3029
BitType x_bit = cpp::bit_cast<BitType>(x);
3130
BitType y_bit = cpp::bit_cast<BitType>(y);
31+
// For some reason, bit_cast cannot deduce BitType from the input.
3232
return cpp::bit_cast<T, BitType>(x_bit & y_bit);
3333
}
3434

3535
template <typename T>
3636
LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_fixed_point_v<T>, T>
3737
bit_or(T x, T y) {
3838
using BitType = typename FXRep<T>::StorageType;
39-
static_assert(sizeof(BitType) * CHAR_BIT == FXRep<T>::TOTAL_LEN);
4039
BitType x_bit = cpp::bit_cast<BitType>(x);
4140
BitType y_bit = cpp::bit_cast<BitType>(y);
41+
// For some reason, bit_cast cannot deduce BitType from the input.
4242
return cpp::bit_cast<T, BitType>(x_bit | y_bit);
4343
}
4444

4545
template <typename T>
4646
LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_fixed_point_v<T>, T>
4747
bit_not(T x) {
4848
using BitType = typename FXRep<T>::StorageType;
49-
static_assert(sizeof(BitType) * CHAR_BIT == sizeof(T) * CHAR_BIT);
5049
BitType x_bit = cpp::bit_cast<BitType>(x);
50+
// For some reason, bit_cast cannot deduce BitType from the input.
5151
return cpp::bit_cast<T, BitType>(~x_bit);
5252
}
5353

utils/bazel/llvm-project-overlay/libc/BUILD.bazel

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,10 +612,15 @@ libc_support_library(
612612

613613
libc_support_library(
614614
name = "__support_fixed_point",
615-
hdrs = ["src/__support/fixed_point/fx_rep.h"],
615+
hdrs = [
616+
"src/__support/fixed_point/fx_rep.h",
617+
"src/__support/fixed_point/fx_bits.h",
618+
],
616619
deps = [
620+
":__support_cpp_bit",
617621
":__support_cpp_type_traits",
618622
":__support_macros_attributes",
623+
":__support_macros_optimization",
619624
":llvm_libc_macros_stdfix_macros",
620625
],
621626
)

0 commit comments

Comments
 (0)