How to get a string out of an __mlir_type.i256 ?
Using the llvm dialect, I can add numbers of any size, In this picture I add 256 bit numbers.
This compiled and ran, which is wonderful, but now I don't know how to get a string out of var c so I can see the result.
In stdlib, the way to print a scalar is so convoluted and complex that I was not able to understand it. If someone knows how to do it using simple MLIR operations, it could benefit anyone trying to create a custom mojo type using MLIR.
In the Modular tutorial, where they create a custom Bool type, they just check if the type is one of two values "False" or "True" to print the result. This is not a viable solution for a type that is bigger than a Bool.
2 Replies
you’d have to cast it to a uint8 and go from there
Curious about the implementation if you may🧐 @curiosity.fan @benny