I noticed that in the source code for zig that there are some predefined CRC structs in (zig/lib/std/hash/crc.zig). I wrote a small test program to try to use them, but they don’t seem to be available in the way that I was expecting.
Compiling with 0.17.0-dev.1426+58a94eaae. I don’t really care about GSM, just an example.
The name string identifier syntax. As @rosew0od noted, you must reference it in quotations with @ prefix, e.g. @"identifier with spaces or other non-standard characters".
Ok, trying to understand how that trick works.
I did a search for “CRC-3/GSM” in the source, and it only shows up as a test label in zig/lib/std/hash/crc/test.zig. Where in the codebase does “CRC-3/GSM” get attached to that particular struct?
NM, I think it is “zig/tools/crc/catalog.txt” … and something must process that file.
It is in defined in the source code, specifically in std.hash.crc.zig. It happens to be the first thing defined in the file.
Guessing by Andrew’s latest commit message of “restore auto-generated status”, I assume the file is indeed generated at some point, though I haven’t spent any time investigating.