aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/unsafe
diff options
context:
space:
mode:
authorEduardo Julian2022-07-26 18:08:04 -0400
committerEduardo Julian2022-07-26 18:08:04 -0400
commitfeacd79496ae9c76492d5a12d30b78724b642654 (patch)
treea85708d1bfe43a98ba62b7f8589dcc95a71f86f5 /stdlib/source/unsafe
parentdec796a9838e39148c007f3f3d360964d7cb68de (diff)
Made inlined functions into first-class macros.
Diffstat (limited to 'stdlib/source/unsafe')
-rw-r--r--stdlib/source/unsafe/lux/data/binary.lux56
1 files changed, 29 insertions, 27 deletions
diff --git a/stdlib/source/unsafe/lux/data/binary.lux b/stdlib/source/unsafe/lux/data/binary.lux
index e90aa4b39..d3b824dfb 100644
--- a/stdlib/source/unsafe/lux/data/binary.lux
+++ b/stdlib/source/unsafe/lux/data/binary.lux
@@ -306,26 +306,27 @@
(again ("lux i64 +" 1 index))))))))]))))
... TODO: Turn into a template ASAP.
-(`` (inlined .public (copy! bytes source_offset source target_offset target)
- (-> .Nat .Nat ..Binary Nat ..Binary ..Binary)
- (with_expansions [<jvm> (java/lang/System::arraycopy source (ffi.as_int (.int source_offset))
- target (ffi.as_int (.int target_offset))
- (ffi.as_int (.int bytes)))
- <jvm> (.exec
- <jvm>
- target)]
- (.for (,, (.static @.old)) <jvm>
- (,, (.static @.jvm)) <jvm>
-
- ... Default
- (.loop (again [index 0])
- (.if ("lux i64 <" (.int bytes) (.int index))
- (.exec
- (..has_8! ("lux i64 +" target_offset index)
- (..bits_8 ("lux i64 +" source_offset index) source)
- target)
- (again ("lux i64 +" 1 index)))
- target))))))
+(`` (def .public copy!
+ (inlined (_ bytes source_offset source target_offset target)
+ (-> .Nat .Nat ..Binary Nat ..Binary ..Binary)
+ (with_expansions [<jvm> (java/lang/System::arraycopy source (ffi.as_int (.int source_offset))
+ target (ffi.as_int (.int target_offset))
+ (ffi.as_int (.int bytes)))
+ <jvm> (.exec
+ <jvm>
+ target)]
+ (.for (,, (.static @.old)) <jvm>
+ (,, (.static @.jvm)) <jvm>
+
+ ... Default
+ (.loop (again [index 0])
+ (.if ("lux i64 <" (.int bytes) (.int index))
+ (.exec
+ (..has_8! ("lux i64 +" target_offset index)
+ (..bits_8 ("lux i64 +" source_offset index) source)
+ target)
+ (again ("lux i64 +" 1 index)))
+ target)))))))
... TODO: Turn into a template ASAP.
(`` (with_expansions [<jvm> (java/util/Arrays::copyOfRange binary
@@ -333,10 +334,11 @@
(ffi.as_int (.int limit)))
<jvm> (.let [limit ("lux i64 +" size offset)]
<jvm>)]
- (inlined .public (slice offset size binary)
- (-> .Nat .Nat ..Binary ..Binary)
- (.for (,, (.static @.old)) <jvm>
- (,, (.static @.jvm)) <jvm>
-
- ... Default
- (..copy! size offset binary 0 (..empty size))))))
+ (def .public slice
+ (inlined (_ offset size binary)
+ (-> .Nat .Nat ..Binary ..Binary)
+ (.for (,, (.static @.old)) <jvm>
+ (,, (.static @.jvm)) <jvm>
+
+ ... Default
+ (..copy! size offset binary 0 (..empty size)))))))