-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: substraction between relocatables should be signed (#1218)
* fix: substraction between relocatables should be signed It is valid as per the reference implementation to substract two relocatables `a - b` where `b.offset > a.offset`. The fix consists in not using the trait as implemented for `Relocatable` (where it represents a positive distance between pointers) but to promote the offsets to `i128` and only substract them for `MaybeRelocatable`, as those are the language-level types. * chore: remove uneeded stuff * Add fix holes to if_reloc_equal.cairo test * chore: changelog --------- Co-authored-by: Pedro Fontana <fontana.pedro93@gmail.com>
- Loading branch information
Showing
4 changed files
with
27 additions
and
1 deletion.
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,16 @@ | ||
from starkware.cairo.common.alloc import alloc | ||
|
||
func main{}() { | ||
let arr: felt* = alloc(); | ||
|
||
assert arr[0] = 1; | ||
assert arr[5] = 2; | ||
|
||
let end = arr + 5; | ||
|
||
if (arr == end) { | ||
ret; | ||
} | ||
|
||
ret; | ||
} |
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