aboutsummaryrefslogtreecommitdiff
path: root/elymas/lib/bin.ey
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2013-08-06 23:09:40 +0200
committerDrahflow <drahflow@gmx.de>2013-08-06 23:09:40 +0200
commita8d7ccc4e6b9f5edaa81fc961ff462ba56a43897 (patch)
tree8bb063d643b56fe0d90348d76da6cf541920e4ca /elymas/lib/bin.ey
parenta0f5e44d1cd8f3d4b12463bf9d0401f0d5623057 (diff)
More syscalls translated
Diffstat (limited to 'elymas/lib/bin.ey')
-rw-r--r--elymas/lib/bin.ey22
1 files changed, 15 insertions, 7 deletions
diff --git a/elymas/lib/bin.ey b/elymas/lib/bin.ey
index 4fe1f4a..74caa04 100644
--- a/elymas/lib/bin.ey
+++ b/elymas/lib/bin.ey
@@ -2,13 +2,21 @@
# as binary data structures
<
- # 0 -> string
- # 0 <- string from 9th byte onwards
- # 1 <- first 8 bytes of string interpreted as 64bit unsigned int
- { ==s
- [ [ 0 1 2 3 4 5 6 7 ] s each ] 256 math .unbase
- 8 s str .postfix
- } /scanu64 deff
+ <
+ # 0 -> number of bytes to combine into unsigned int
+ # 1 -> string
+ # 0 <- string from (w+1)th byte onwards
+ # 1 <- first w bytes of string interpreted as unsigned int
+ { ==w ==s
+ w s str .postfix
+ [ 0 w range s each ] 256 math .unbase
+ } /uw deff
+
+ { 8 uw } /u64 deff
+ { 4 uw } /u32 deff
+ { 2 uw } /u16 deff
+ { 1 uw } /u8 deff
+ > /scan defv
> /bin defv
# vim: syn=elymas