Skip to content

Commit 32944f7

Browse files
committed
expanded builtin atoi to handle $ and %
1 parent 146e200 commit 32944f7

File tree

3 files changed

+465
-448
lines changed

3 files changed

+465
-448
lines changed

Changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Version 6.4.0
22
- Added getcrc() builtin for Spin2
33
- Added VFS layer for Parallax flash file system
4+
- Added recognition for "$" and "%" to __builtin_atoi
45
- Changed littlefs to not return . and .. entries in path search (so it matches host fs and FATFS)
56
- Fixed compilation error for object arrays in bytecode
67
- Fixed some quirks in the space/tab warning code

sys/float.spin

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,15 @@ pri __builtin_atoi(s = "0", base=0) : r = long | c, negate, digit
233233
if (c == "-")
234234
negate := 1 - negate
235235
c := byte[s]
236-
236+
237+
if base == 0
238+
if c == "$"
239+
base := 16
240+
s++
241+
elseif c == "%"
242+
base := 2
243+
s++
244+
237245
repeat
238246
repeat
239247
c := byte[s++]

0 commit comments

Comments
 (0)