ssm-lang / Scoria

This is an embedding of the Sparse Synchronous Model, in Haskell!
BSD 3-Clause "New" or "Revised" License
4 stars 0 forks source link

Don't assume long == 64-bit #79

Open j-hui opened 3 years ago

j-hui commented 3 years ago

We currently assume that C defines typedef int64_t long and typedef uint64_t unsigned long. This is not true on all platforms; for instance, Apple M1 and my NRF52 board (maybe this is an Arm-specific thing?).

Most of the generated code should be fairly robust to this, since we use our own i64 and u64 definitions. But two places where we rely on long == u64 are:

At the very least, this throws warnings. At worst, this causes unexpected behavior. We should modify the Backend compilation pass to be parametrized by some idea of what size the platform thinks long is, or better yet, make Backend agnostic of this issue and push the matter into C.