builtins.c 370 B

1234567891011121314
  1. #include "log_err.h"
  2. #include "machine.h"
  3. word bltn_plus(word x, word y) {
  4. if(TAG(x) != tag_integer) {
  5. log_err("first argument had type %s, not an integer", tag_name[TAG(x)]);
  6. }
  7. if(TAG(y) != tag_integer) {
  8. log_err("second argument had type %s, not an integer", tag_name[TAG(y)]);
  9. }
  10. return OBJECT_TAG_VAL(tag_integer, (VAL(x) + VAL(y)) & VAL_BITS);
  11. }