Closed themixednuts closed 3 months ago
I just tested the following code and it ran without problems. This was recently added so make sure you update the libraries in the content store before trying it again.
import std.hash;
str test = "hello";
std::print("{}",std::hash::crc32(test, 0xFFFFFFFF, 0x04C11DB7, 0xFFFFFFFF, true, true));
I just tested the following code and it ran without problems. This was recently added so make sure you update the libraries in the content store before trying it again.
import std.hash; str test = "hello"; std::print("{}",std::hash::crc32(test, 0xFFFFFFFF, 0x04C11DB7, 0xFFFFFFFF, true, true));
Interesting. Still have the issue, even after exiting and relaunching.
import std.hash;
fn main(){
str test = "hello";
std::print("{}",std::hash::crc32(test, 0xFFFFFFFF, 0x04C11DB7, 0xFFFFFFFF, true, true));
};
// results
E: [ Stack Trace ]
E: C:\Users\****\AppData\Local\imhex\includes\std/hash.pat:48:94
E: 48 | reflect_in, reflect_out);
E: ^
E: <Source Code>:113:86
E: 113 | 0xFFFFFFFF, true, true));
E: ^
E: runtime error: Cannot cast value to type 'pattern'.
Does the crc32 function in the library looks like this?
fn crc32(ref auto pattern, u32 init, u32 poly, u32 xorout, bool reflect_in, bool reflect_out) {
return builtin::std::hash::crc32(pattern, init, poly, xorout, reflect_in, reflect_out);
};
in particular, does it have the builtin::
part added?
yea this is what the file shows
// C:\Users\*****\AppData\Local\imhex\includes\std\hash.pat : ln 47
fn crc32(ref auto pattern, u32 init, u32 poly, u32 xorout, bool reflect_in, bool reflect_out) {
return builtin::std::hash::crc32(pattern, init, poly, xorout, reflect_in, reflect_out);
};
You must be running an older version of Imhex, one built before the fix was added on 7/7.
That was it, off by one minor patch, thank you!
yeah sorry about that. I made the assumption that the fixes were done in the library include file but seeing how yours was identical I went back and looked at the actual fix changes and noticed that .cpp files were changed which indicates imhex needs updating. A bit of running around but you got it working. Good deal! and thanks for closing the issue.
string
is of type str, but I've also tried literal numbers and same error.