Closed ridiculousfish closed 2 years ago
@adbancroft if possible please check whether this works with your AVR setup, thank you
@adbancroft if possible please check whether this works with your AVR setup, thank you
The tests passed on both simulator & real hardware (AT Mega 2560)
To restate #96: currently libdivide "dispatches" based on whether its type is
uint32_t
,uint64_t
, etc. However these types are mapped to a primitive type likeunsigned int
; if sayunsigned long
has the same width thendivider<unsigned long>
will fail to compile since there is no specialization for it.The idea here is to go back to a dispatch based on the size and signedness of the type, so that
unsigned long
andunsigned int
will be handled the same. To detect the signedness we avoidtype_traits
which is apparently unavailable in AVR; instead we use the following trick:which will be true only for signed types. We can prevent floating point by throwing in a shift:
An inelegant hack for an uncivilized language but it does the job. Fixes #96.