Questions tagged [extint]

_ExtInt is an exact bit-width data type in C and C++ supported by the Clang compiler.

_ExtInt runs on LLVM's any size int. You can make 1 to 16,777,215 bit integers.

10 questions
15
votes
2 answers

256-bit arithmetic in Clang (extended integers)

I'm in the design phase of a project that needs to do a lot of simple 256-bit integer arithmetic (add, sub, mul, div only) and need something that is reasonably well optimised for these four operations. I'm already familiar with GMP, NTL and most of…
Owen2020
  • 153
  • 6
3
votes
2 answers

How do you printf _ExtInt without using casts?

I was wondering how you could printf _ExtInts in clang without using casts. Something like this: #include int main() { _ExtInt(13) foo = 100; printf("%???", foo); } With casts, it would look like this (this is not what I…
xilpex
  • 3,097
  • 2
  • 14
  • 45
3
votes
1 answer

How do you use clang's new custom size int feature?

Recently, I heard that clang got a new feature, _ExtInt. I know that it lets you specify the size of an integer (odd or even like 13-bit int), but how do you use it?
xilpex
  • 3,097
  • 2
  • 14
  • 45
2
votes
1 answer

Does clang have _ExtFloat just like it has _ExtInt?

I've recently been looking into clang's _ExtInt feature (allows you to declare any size int) a lot and was just wondering if there is also an _ExtFloat which I could use to create custom size floats.
xilpex
  • 3,097
  • 2
  • 14
  • 45
2
votes
2 answers

Will clangs custom int size feature ever get added to gcc?

I was wondering whether clang's new amazing custom size (things like 13-bit int, or 70-bit int, etc.) will get added to gcc.
xilpex
  • 3,097
  • 2
  • 14
  • 45
1
vote
1 answer

_ExtInt(256) doesn't work in CLang 14, but works in CLang 13

When CLang 14 was released I noticed that following code doesn't compile anymore (but works in CLang 13): Try it online! int main() { using T = _ExtInt(256); } This code was used to create fixed size integers of arbitrary bit length, even of…
Arty
  • 14,883
  • 6
  • 36
  • 69
1
vote
2 answers

How to initialize an _Extint() from an hardcoded litteral?

The rust project I m using depends on fixed_hash 0.2.2. And I would need to compare one H160 against a literal (mode exactly know if my_var==0xdac17f958d2ee523a2206206994597c13d831ec7). Internally, the H160 type is just a pointer to a plain integer…
user2284570
  • 2,891
  • 3
  • 26
  • 74
0
votes
0 answers

Performance of Clang's _bitInt(256) vs Boost Multiprecision int256_t

I'm after the fastest 256 bit integer library (which isn't a nightmare to integrate). As part of this I'm trying to get a rough idea of the performance comparison between Clang's _Bitint(256) and Boost multiprecision's int256_t. I've currently got…
intrigued_66
  • 16,082
  • 51
  • 118
  • 189
0
votes
0 answers

AVR simulator: XINT0 behaves not as expected

When simulating my ATTiny13 application in AVR Studio7 (latest version 7.0.2594, no stimuli file), XINT0 does not respond as I would expect: In MCUCR I set ISC01|ISC00 to 0x02 because I want to trigger on the falling edge of XINT0. When manipulating…
0
votes
1 answer

How to make dynamic bit width integers in C?

I want to represent extended integers and came across _BitInt() but it doesn't work dynamically. I'm trying to do something like this: void fun(int n) { _BitInt(n)* val = malloc(n); //doesn't work } I understand that everything stored on the…