Skip to content

Commit

Permalink
Add comments on magic numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Feb 23, 2024
1 parent bd8c932 commit 27e3ac8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/api/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func retrieveIterator(callID uint64, iteratorID uint64) types.Iterator {
// The second value marks if the conversion succeeded.
func iteratorIdToIndex(id uint64) (int, bool) {
if id < 1 || id > math.MaxInt32 {
// If success is false, the int value is undefined. We use an arbitrary constant for potential debugging purposes.
return 777777777, false
}

Expand All @@ -115,6 +116,7 @@ func iteratorIdToIndex(id uint64) (int, bool) {
// The second value marks if the conversion succeeded.
func indexToIteratorID(index int) (uint64, bool) {
if index < 0 || index > math.MaxInt32 {
// If success is false, the return value is undefined. We use an arbitrary constant for potential debugging purposes.
return 888888888, false
}

Expand Down

0 comments on commit 27e3ac8

Please sign in to comment.