Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.