-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1764 from Smit-create/i-1588
Add ``UnsignedInteger`` type in ASR
- Loading branch information
Showing
9 changed files
with
406 additions
and
12 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,28 @@ | ||
from lpython import inline, u32 | ||
|
||
@inline | ||
def uadd(x: u32, y: u32) -> u32: | ||
return x + y | ||
|
||
@inline | ||
def uand_op(x: u32, y: u32) -> u32: | ||
return x & y | ||
|
||
def main1(): | ||
x: u32 | ||
y: u32 | ||
z: u32 | ||
x = (u32(2)+u32(3))*u32(5) | ||
y = uadd(x, u32(2))*u32(2) | ||
assert x == u32(25) | ||
assert y == u32(54) | ||
|
||
z = uand_op(x, y) | ||
assert z == u32(16) | ||
|
||
|
||
main1() | ||
|
||
# Not implemented yet in LPython: | ||
#if __name__ == "__main__": | ||
# main() |
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
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
Oops, something went wrong.