diff options
author | Abhinav Kumar <96587705+kr-2003@users.noreply.github.com> | 2025-04-03 02:11:47 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-02 16:41:47 -0400 |
commit | 51d1c7288662ea801b07133fd2d22aff6bac50e2 (patch) | |
tree | 695e0158b49694e22ff32c5a4daba8b39150c7f0 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 554859c73688ec11786a060613989d1a333991bb (diff) | |
download | llvm-51d1c7288662ea801b07133fd2d22aff6bac50e2.zip llvm-51d1c7288662ea801b07133fd2d22aff6bac50e2.tar.gz llvm-51d1c7288662ea801b07133fd2d22aff6bac50e2.tar.bz2 |
[libc] Added support for fixed-points in ``is_signed`` and ``is_unsigned``. (#133371)
Fixes #133365
## Changes Done
- Changed the signed checking to
```cpp
struct is_signed : bool_constant<((is_fixed_point<T> || is_arithmetic_v<T>) && (T(-1) < T(0)))>
```
in ``/libc/src/__support/CPP/type_traits/is_signed.h``. Added check for
fixed-points.
- But, got to know that this will fail for ``unsigned _Fract`` or any
unsigned fixed-point because ``unsigned _Fract`` can’t represent -1 in
T(-1), while ``unsigned int`` can handle it via wrapping.
- That's why I explicity added ``is_signed`` check for ``unsigned``
fixed-points.
- Same changes to ``/libc/src/__support/CPP/type_traits/is_unsigned.h``.
- Added tests for ``is_signed`` and ``is_unsigned``.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions