Depending on the target architecture, some integer multiplicative
operators might be implemented by support routines. These support
routines exist in portable C versions to facilitate porting to other
MCUs, although depending on the target, assembler routines might be
used instead. The following files contain some of the described routines,
all of them can be found in <installdir>/share/sdcc/lib.
Function | Description |
---|---|
_mulint.c | 16 bit multiplication |
_divsint.c | signed 16 bit division (calls _divuint) |
_divuint.c | unsigned 16 bit division |
_modsint.c | signed 16 bit modulus (calls _moduint) |
_moduint.c | unsigned 16 bit modulus |
_mullong.c | 32 bit multiplication |
_divslong.c | signed 32 division (calls _divulong) |
_divulong.c | unsigned 32 division |
_modslong.c | signed 32 bit modulus (calls _modulong) |
_modulong.c | unsigned 32 bit modulus |
In the mcs51, ds390, hc08, s08, pdk13, pdk14, pdk15, pic14 and pic16 backends they are by default compiled as non-reentrant; when targeting on of these architectures, interrupt service routines should not do any of the above operations. If this is unavoidable then the above routines will need to be compiled with the —stack-auto option, after which the source program will have to be compiled with —int-long-reent option. Notice that you don't have to call these routines directly. The compiler will use them automatically every time an integer operation is required.