Comments (2)
LLVM can take arbitrary sized integers, so really even a u128
wouldn't be sufficient. The use of u64
comes from the C++ API (which decides the C API), since 128 bit integers aren't widely supported and don't exactly have great ABI compatibility.
If you want to construct constant integers with more than 64 bits, you can use const_int_from_string
which will parse it for a simple solution, or you can use const_int_arbitrary_precision
to pass in a slice of u64
s, which is generally a better solution.
If you insist on using u128
, then this should do what you need:
fn const_int_u128(ty: IntType, val: u128) -> IntValue {
let bytes = [(val & 0xffffffffffffffff) as u64, (val >> 64) as u64];
ty.const_int_arbitrary_precision(&bytes)
}
Generally though, 64 bit integers are more than enough.
from inkwell.
Thanks
from inkwell.
Related Issues (20)
- Support LLVM 18.1 HOT 2
- `Context::metadata_string` doc example returns an error
- rename `build_bitcast` to `build_bit_cast` HOT 1
- Wrong thread-safety trait implementing on LLVMString HOT 3
- Add set_opaque_pointers to Context
- Can't find Polly :( (tried the other posted issue too ) HOT 2
- Can't build due to missing zstd.dll.lib
- Can't Box Token inside BasicValue HOT 2
- unifying apis that require sign flag.
- Can't create declaration for intrinsic with a pointer parameter
- Inkwell cannot be built on MacOS
- Mystery compilation errors with x86_64-unknown-linux-musl compilation target HOT 1
- Can I add an feature wich isn't in normal LLVM? HOT 4
- Struct GEPPointee error when attempting to access struct field.
- Cargo fails due to missing features HOT 2
- Most (all?) passes have a maximum LLVM version number of 16. HOT 1
- Build failing on Mac OS HOT 2
- `get_string_constant` is invalid
- Provide a `Context` method to construct `ArrayType` and `FunctionType` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from inkwell.