Bindat: Document sint
; add le
arg to uint
; deprecate uintr
* lisp/emacs-lisp/bindat.el (bindat--type) <uint>: Add `le` optional arg. (bindat--type) <uintr>: Delete method. (uintr): Re-define as a bindat-macro instead. (bindat-type): Update docstring accordingly. (bindat--primitives): Update. (sint): Simplify. * doc/lispref/processes.texi (Bindat Types): Update `uint`, add `sint`, and remove `uintr`. * test/lisp/emacs-lisp/bindat-tests.el (data-bindat-spec): Use the new `le` arg of `uint` instead of `uintr`.
This commit is contained in:
parent
b591a041e3
commit
51def94e9c
3 changed files with 33 additions and 33 deletions
|
@ -36,7 +36,7 @@
|
|||
(bindat-type
|
||||
(type u8)
|
||||
(opcode u8)
|
||||
(length uintr 16) ;; little endian order
|
||||
(length uint 16 'le) ;; little endian order
|
||||
(id strz 8)
|
||||
(data vec length)
|
||||
(_ align 4)))
|
||||
|
@ -128,18 +128,17 @@
|
|||
(r (zerop (% kind 2))))
|
||||
(dotimes (_ 100)
|
||||
(let* ((n (random (ash 1 bitlen)))
|
||||
(i (- n (ash 1 (1- bitlen)))))
|
||||
(i (- n (ash 1 (1- bitlen))))
|
||||
(stype (bindat-type sint bitlen r))
|
||||
(utype (bindat-type if r (uintr bitlen) (uint bitlen))))
|
||||
(should (equal (bindat-unpack
|
||||
(bindat-type sint bitlen r)
|
||||
(bindat-pack (bindat-type sint bitlen r) i))
|
||||
stype
|
||||
(bindat-pack stype i))
|
||||
i))
|
||||
(when (>= i 0)
|
||||
(should (equal (bindat-pack
|
||||
(bindat-type if r (uintr bitlen) (uint bitlen)) i)
|
||||
(bindat-pack (bindat-type sint bitlen r) i)))
|
||||
(should (equal (bindat-unpack
|
||||
(bindat-type if r (uintr bitlen) (uint bitlen))
|
||||
(bindat-pack (bindat-type sint bitlen r) i))
|
||||
(should (equal (bindat-pack utype i)
|
||||
(bindat-pack stype i)))
|
||||
(should (equal (bindat-unpack utype (bindat-pack stype i))
|
||||
i))))))))
|
||||
|
||||
(defconst bindat-test--LEB128
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue