summaryrefslogtreecommitdiffstats
path: root/stdlib/socket.tl
diff options
context:
space:
mode:
authorPaul A. Patience <paul@apatience.com>2021-09-12 00:43:22 -0400
committerKaz Kylheku <kaz@kylheku.com>2021-09-14 00:19:02 -0700
commit7c174401f4926683d26e5b638b95d8956cfdb211 (patch)
treedba83899339f3621eb26d9e6bddf7c42855127b3 /stdlib/socket.tl
parent44f4ef01ce095d334769b071460f19c5d74217c3 (diff)
downloadtxr-7c174401f4926683d26e5b638b95d8956cfdb211.tar.gz
txr-7c174401f4926683d26e5b638b95d8956cfdb211.tar.bz2
txr-7c174401f4926683d26e5b638b95d8956cfdb211.zip
defset: add set-mask and clear-mask.
* stdlib/defset.tl (set-mask, clear-mask): New update macros. * stdlib/optimize.tl (calc-liveness): Use the new macros. * stdlib/socket.tl (sys:str-inaddr-net-impl, str-in6addr-net): Same. * stdlib/termios.tl (set-iflags, set-oflags, set-cflags, set-lflags, clear-iflags, clear-oflags, clear-cflags, clear-lflags): Same. * lisplib.c (defset_set_entries): Add set-mask and clear-mask to autoload symbols for defset. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'stdlib/socket.tl')
-rw-r--r--stdlib/socket.tl24
1 files changed, 12 insertions, 12 deletions
diff --git a/stdlib/socket.tl b/stdlib/socket.tl
index eac123be..aeb33dbe 100644
--- a/stdlib/socket.tl
+++ b/stdlib/socket.tl
@@ -102,11 +102,11 @@
(defun sys:str-inaddr-net-impl (addr wextra : weff)
(let ((mask addr))
- (set mask (logior mask (ash mask 1)))
- (set mask (logior mask (ash mask 2)))
- (set mask (logior mask (ash mask 4)))
- (set mask (logior mask (ash mask 8)))
- (set mask (logior mask (ash mask 16)))
+ (set-mask mask (ash mask 1))
+ (set-mask mask (ash mask 2))
+ (set-mask mask (ash mask 4))
+ (set-mask mask (ash mask 8))
+ (set-mask mask (ash mask 16))
(let* ((w (- 32 (width (lognot mask 32))))
(d (logand addr #xFF))
(c (logand (ash addr -8) #xFF))
@@ -130,13 +130,13 @@
(= (ash addr -32) #xFFFF))
`::ffff:@(sys:str-inaddr-net-impl (logtrunc addr 32) 96 width)`
(let ((mask addr))
- (set mask (logior mask (ash mask 1)))
- (set mask (logior mask (ash mask 2)))
- (set mask (logior mask (ash mask 4)))
- (set mask (logior mask (ash mask 8)))
- (set mask (logior mask (ash mask 16)))
- (set mask (logior mask (ash mask 32)))
- (set mask (logior mask (ash mask 64)))
+ (set-mask mask (ash mask 1))
+ (set-mask mask (ash mask 2))
+ (set-mask mask (ash mask 4))
+ (set-mask mask (ash mask 8))
+ (set-mask mask (ash mask 16))
+ (set-mask mask (ash mask 32))
+ (set-mask mask (ash mask 64))
(let* ((w (- 128 (width (lognot mask 128))))
(pieces (let ((count 8))
(nexpand-left (lambda (val)