-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Update lib/pure/bitops.nim * Update lib/system/sets.nim * Apply suggestions from code review Co-authored-by: Andreas Rumpf <[email protected]>
- Loading branch information
Showing
4 changed files
with
98 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
template forwardImpl*(impl, arg) {.dirty.} = | ||
when sizeof(x) <= 4: | ||
when x is SomeSignedInt: | ||
impl(cast[uint32](x.int32)) | ||
else: | ||
impl(x.uint32) | ||
else: | ||
when x is SomeSignedInt: | ||
impl(cast[uint64](x.int64)) | ||
else: | ||
impl(x.uint64) | ||
|
||
template toUnsigned*(x: int8): uint8 = cast[uint8](x) | ||
template toUnsigned*(x: int16): uint16 = cast[uint16](x) | ||
template toUnsigned*(x: int32): uint32 = cast[uint32](x) | ||
template toUnsigned*(x: int64): uint64 = cast[uint64](x) | ||
template toUnsigned*(x: int): uint = cast[uint](x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters