-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* First line of 64bit support, try to use inline ifs Major changes builder.rs * Finished with 32bit, cosmetic need to be done * most ifs removed, composition with struct * fixed bug with the memory writing * 32bit overflow bad state added, some polishings needs to be done * added 32 bit flag * 32bit flag bug fixes, to small memory * Overflow check redone * Overflow check redone --------- Co-authored-by: Patrick Weber <[email protected]>
- Loading branch information
Showing
12 changed files
with
411 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
uint64_t main() { | ||
uint64_t a; | ||
uint64_t* x; | ||
|
||
a = 2147483647; | ||
|
||
x = malloc(8); | ||
|
||
*x = 0; | ||
|
||
read(0, x, 1); | ||
|
||
a = a + *x; | ||
|
||
return 0; | ||
} |
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 @@ | ||
uint64_t main() { | ||
uint64_t a; | ||
uint64_t* x; | ||
uint64_t y; | ||
|
||
a = 2147483647; | ||
|
||
x = malloc(8); | ||
|
||
*x = 0; | ||
|
||
read(0, x, 1); | ||
|
||
a = a * *x; | ||
|
||
return 0; | ||
} |
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,40 @@ | ||
// printing the negative decimal number -7 in C* | ||
|
||
// libcstar procedures for printing | ||
void init_library(); | ||
void print(uint64_t* s); | ||
void print_integer(uint64_t n); | ||
void print_hexadecimal(uint64_t n, uint64_t a); | ||
void print_octal(uint64_t n, uint64_t a); | ||
void print_binary(uint64_t n, uint64_t a); | ||
void println(); | ||
|
||
uint64_t main() { | ||
// initialize selfie's libcstar library | ||
init_library(); | ||
|
||
// print the integer literal -7 in decimal | ||
print("-7 in decimal: "); | ||
print_integer(-7); | ||
print(" (as signed 64-bit integer)\n"); | ||
|
||
// print the integer literal -7 in decimal | ||
print("-7 in decimal: "); | ||
print_unsigned_integer(-7); | ||
print(" (as unsigned integer)\n"); | ||
|
||
// print the integer literal -7 in hexadecimal | ||
print("-7 in hexadecimal: "); | ||
print_hexadecimal(-7, 0); | ||
println(); | ||
|
||
// print the integer literal -7 in octal | ||
print("-7 in octal: "); | ||
print_octal(-7, 0); | ||
println(); | ||
|
||
// print the integer literal -7 in binary | ||
print("-7 in binary: "); | ||
print_binary(-7, 0); | ||
println(); | ||
} |
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,16 @@ | ||
uint64_t main() { | ||
uint64_t a; | ||
uint64_t* x; | ||
|
||
a = -2147483645; | ||
|
||
x = malloc(8); | ||
|
||
*x = 0; | ||
|
||
read(0, x, 1); | ||
|
||
a = a - *x; | ||
|
||
return a; | ||
} |
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
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 |
---|---|---|
|
@@ -47,6 +47,7 @@ pub(crate) fn load( | |
ByteSize::mib(1).as_u64(), | ||
8, | ||
32, | ||
false, | ||
&argv, | ||
) | ||
.unwrap(); | ||
|
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.