[libc] [llvm] [libc][stdfix] Add round functions for fixed point types. (PR #81994)

via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 16 09:27:53 PST 2024


================
@@ -19,6 +21,36 @@
 
 namespace LIBC_NAMESPACE::fixed_point {
 
+// Bit-wise operations are not available for fixed point types yet.
+template <typename T>
+LIBC_INLINE constexpr cpp::enable_if_t<cpp::is_fixed_point_v<T>, T>
+bit_and(T x, T y) {
+  using BitType = typename FXRep<T>::StorageType;
+  static_assert(sizeof(BitType) * CHAR_BIT == sizeof(T) * CHAR_BIT);
----------------
lntue wrote:

Removed debugging assertion.

https://github.com/llvm/llvm-project/pull/81994


More information about the llvm-commits mailing list