Re: Sizeof int_fastN_t vs uint_fastN_t data types
Martin Husemann <[email protected]> Mon, 18 Nov 2024 10:54:45 +0100
| Newsgroups | gmane.os.netbsd.ports.sparc64 |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Nov 18, 2024 at 09:00:59AM +0000, Sad Clouds wrote: > I would expect discrepancy between OSes, e.g. Linux aarch64 defines > fast versions for 16 and 32 bit integers at 8 bytes, NetBSD aarch64 > defines fast versions for 16 and 32 bit integers at 4 bytes. However, > the same OS defining different sizes for signed and unsigned fast > integers seems a bit strange. Is there really that much overhead for > signed integer arithmetic on sparc64? Registers are 8 byte and sign extension is (relatively) expensive. There are only native arithmetic instuctions for 4 byte and 8 byte values (and the 4 byte versions may still need sign extension at the end). You can try and look at the differences in the assembler code generated for _fast vs. non-fast variants of the same code. Compilers have gotten incredible smart and I would expect the optimized code to be not much different in most cases, but it would be interesting to compare that for some real-world cases where the _fast variants are used. Martin