diff --git a/src/fh_builtins_arith.c b/src/fh_builtins_arith.c index c068ef5..8660780 100644 --- a/src/fh_builtins_arith.c +++ b/src/fh_builtins_arith.c @@ -205,7 +205,11 @@ static enum fh_error w_within(struct fh_thread_s *fh, const struct fh_word_s *w) // (t-l) (h-l) | U< // =within - bool within = 0; // TODO + const int32_t ti = (int32_t)test; + const int32_t li = (int32_t)low; + const int32_t hi = (int32_t)high; + + const bool within = (uint32_t)(ti-li) < (uint32_t)(hi-li); TRY(ds_push(fh, TOBOOL(within))); return FH_OK; @@ -517,7 +521,7 @@ static enum fh_error w_um_mod(struct fh_thread_s *fh, const struct fh_word_s *w) TRY(ds_pop(fh, &div)); TRY(ds_pop_dw(fh, &num)); - uint64_t res = num / (uint64_t)div; // TODO verify this may be wrong + uint64_t res = num / (uint64_t)div; uint64_t rem = num % (uint64_t)div; if ((uint64_t)(uint32_t)rem != rem) {