[libc-commits] [libc] [libc] add FXBits class (PR #82065)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Tue Feb 20 10:52:05 PST 2024


================
@@ -19,6 +21,74 @@
 
 namespace LIBC_NAMESPACE::fixed_point {
 
+template <typename T> struct FXBits {
+private:
+  using fx_rep = FXRep<T>;
+  using StorageType = typename fx_rep::StorageType;
+
+  StorageType value;
+
+  static_assert(fx_rep::FRACTION_LEN > 0);
+
+  static constexpr size_t FRACTION_OFFSET = 0; // Just for completeness
----------------
michaelrj-google wrote:

we shouldn't need `LIBC_INLINE_VAR` for any constexpr variables. It's a linkage problem and if the number is a compile time constant the linker shouldn't need to touch it as far as I know.

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


More information about the libc-commits mailing list