Skip to content

Commit

Permalink
expanded builtin atoi to handle $ and %
Browse files Browse the repository at this point in the history
  • Loading branch information
totalspectrum committed Aug 31, 2023
1 parent 146e200 commit 32944f7
Show file tree
Hide file tree
Showing 3 changed files with 465 additions and 448 deletions.
1 change: 1 addition & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Version 6.4.0
- Added getcrc() builtin for Spin2
- Added VFS layer for Parallax flash file system
- Added recognition for "$" and "%" to __builtin_atoi
- Changed littlefs to not return . and .. entries in path search (so it matches host fs and FATFS)
- Fixed compilation error for object arrays in bytecode
- Fixed some quirks in the space/tab warning code
Expand Down
10 changes: 9 additions & 1 deletion sys/float.spin
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,15 @@ pri __builtin_atoi(s = "0", base=0) : r = long | c, negate, digit
if (c == "-")
negate := 1 - negate
c := byte[s]


if base == 0
if c == "$"
base := 16
s++
elseif c == "%"
base := 2
s++

repeat
repeat
c := byte[s++]
Expand Down
Loading

0 comments on commit 32944f7

Please sign in to comment.