• R/O
  • HTTP
  • SSH
  • HTTPS

Thun: Commit

Interpreter and library.


Commit MetaInfo

Révisionf844dbab6c7fcd7da745b91f3830f87d76e4efc4 (tree)
l'heure2023-03-23 06:45:54
AuteurSimon Forman <sforman@hush...>
CommiterSimon Forman

Message de Log

Minor cleanup.

Change Summary

Modification

--- a/implementations/uvm-ncc/joy.c
+++ b/implementations/uvm-ncc/joy.c
@@ -413,21 +413,10 @@ push_int(u32 n, u32 stack)
413413 bool
414414 is_integer(char *str, u32 index, u32 length)
415415 {
416+ str = str + index;
416417 for (;length; --length) {
417- char ch = *(str + index + length - 1);
418- if (!(ch == '0'
419- || ch == '1'
420- || ch == '2'
421- || ch == '3'
422- || ch == '4'
423- || ch == '5'
424- || ch == '6'
425- || ch == '7'
426- || ch == '8'
427- || ch == '9'))
428- {
429- return 0;
430- }
418+ char ch = *(str + length - 1);
419+ if (ch < '0' || ch > '9') return 0;
431420 }
432421 return 1;
433422 }
@@ -439,8 +428,7 @@ convert_integer(char *str, u32 index, u32 length)
439428 length = length + index;
440429 for (; index < length; ++index) {
441430 char ch = *(str + index);
442- u8 digit = (u8)ch - (u8)'0';
443- result = result * 10 + digit;
431+ result = result * 10 + ((u8)ch - (u8)'0');
444432 }
445433 //print_str("converted integer ");print_i64(result);print_endl();
446434 return JOY_VALUE(joyInt, result);
Afficher sur ancien navigateur de dépôt.