diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2016-10-31 22:56:25 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2016-10-31 22:56:25 -0700 |
commit | 9d9da2adf96d783ae51edc1bf6c9cbe6017ead8f (patch) | |
tree | 8e34d2dbc40041a06cc44110a3973aed90f40e55 /070table.mu | |
parent | 1167f8779c2de268a074fc8656f022721df56c3f (diff) | |
download | mu-9d9da2adf96d783ae51edc1bf6c9cbe6017ead8f.tar.gz |
3618
Diffstat (limited to '070table.mu')
-rw-r--r-- | 070table.mu | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/070table.mu b/070table.mu index d567475c..171bb2a8 100644 --- a/070table.mu +++ b/070table.mu @@ -52,7 +52,7 @@ def put-index table:&:table:_key:_value, key:_key, value:_value -> table:&:table hash <- abs hash capacity:num <- get *table, capacity:offset _, hash-key:num <- divide-with-remainder hash, capacity - hash-key <- abs hash-key # in case hash-key overflows into a negative integer + hash-key <- abs hash-key # in case hash overflows from a double into a negative integer inside 'divide-with-remainder' above table-data:&:@:table-row:_key:_value <- get *table, data:offset x:table-row:_key:_value <- index *table-data, hash-key occupied?:bool <- get x, occupied?:offset @@ -69,7 +69,7 @@ def index table:&:table:_key:_value, key:_key -> result:_value [ hash <- abs hash capacity:num <- get *table, capacity:offset _, hash-key:num <- divide-with-remainder hash, capacity - hash-key <- abs hash-key # in case hash-key overflows into a negative integer + hash-key <- abs hash-key # in case hash overflows from a double into a negative integer inside 'divide-with-remainder' above table-data:&:@:table-row:_key:_value <- get *table, data:offset x:table-row:_key:_value <- index *table-data, hash-key occupied?:bool <- get x, occupied?:offset |