Where do functions like `__eq`, `__size_of`, `__add`, `__state_store_*`, etc come from?

Where do functions like __eq, __size_of, __add, __state_store_*, etc used in both std and core libs come from? Where can I check their implementation?

These are compiler intrinsics so they are defined in the compiler itself. https://github.com/FuelLabs/sway/pull/3379 adds a page to the Sway book to describe them. That being said, they should almost never be used directly by end users. Most of them have wrappers in the standard library or core.

5 Likes

Those intrinsics are now properly documented in the book here: Compiler Intrinsics - The Sway Programming Language :slight_smile:

3 Likes