summaryrefslogtreecommitdiff
path: root/chapter-modules/src/main/smp/sys/ary.smp
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-10-24 15:25:58 -0700
committerCliff Click <cliffc@acm.org>2026-10-24 15:25:58 -0700
commit4ae6a06d94b228a5eb67c8473131a791e310c233 (patch)
tree839dfa84f1bfb982122ce62183b6ae4145a4c615 /chapter-modules/src/main/smp/sys/ary.smp
parentc4364363dbd969c9aa27aa7c43fbe6d40544501a (diff)
downloadSimple-4ae6a06d94b228a5eb67c8473131a791e310c233.tar.gz
Simple-4ae6a06d94b228a5eb67c8473131a791e310c233.zip
Rename modules chapter to 28a
Diffstat (limited to 'chapter-modules/src/main/smp/sys/ary.smp')
-rw-r--r--chapter-modules/src/main/smp/sys/ary.smp24
1 files changed, 0 insertions, 24 deletions
diff --git a/chapter-modules/src/main/smp/sys/ary.smp b/chapter-modules/src/main/smp/sys/ary.smp
deleted file mode 100644
index 8312e94c..00000000
--- a/chapter-modules/src/main/smp/sys/ary.smp
+++ /dev/null
@@ -1,24 +0,0 @@
-
-// Array utilities
-
-// Copy byte array contents. Copies the shorter of the buffers and len
-val copy = { u8[] dst, int doff, u8[~] src, int soff, int len ->
- if( len > dst# - doff ) len = dst# - doff;
- if( len > src# - soff ) len = src# - soff;
- for( int i=0; i<len; i++ )
- dst[i+doff] = src[i+soff];
- return dst;
-};
-
-// Compare lexigraphically array contents. Compares up to shorter array or
-// len. Returns <0 or >0 for first non-matching byte. Returns <0 or >0 for
-// the larger array after that, or 0 if both arrays are fully equal.
-val cmp = { u8[~] src1, u32 off1, u8[~] src2, u32 off2, u32 len ->
- u32 len1 = len > src1# - off1 ? src1# - off1 : len;
- u32 len2 = len > src2# - off2 ? src2# - off2 : len;
- u32 max = len1 > len2 ? len2 : len1;
- for( int i=0; i<max; i++ )
- if( src1[off1+i] != src2[off2+i] )
- return src1[off1+i] - src2[off2+i]; // Bytes determine compare
- return len1 - len2; // Length determines compare
-};