[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#32252: i find binary-as-unsigned to be very helpful
From: |
snickerbockers |
Subject: |
bug#32252: i find binary-as-unsigned to be very helpful |
Date: |
Mon, 04 Jul 2022 01:03:26 +0000 |
hello,
I use binary-as-unsigned in my .emacs, and I saw that the help
page
said to e-mail you if I find it useful. Below is a function i
made that
displays a 32-bit two's complement of a given integer in hex. I
do a
lot of reverse-engineering of low-level programs, so it is very
useful
for me to have a quick way to see how a given integer is actually
represented in the hardware. if binary-as-unsigned wasn't
available to
make format do most of the work for me, this function would be a
lot
longer and more complicated.
(defun to-hex(value)
"convert a signed int to its 32-bit two's complement in hex
notation"
(interactive "svalue:")
(let ((binary-as-unsigned t))
(message (substring (format "%08x" (cl-parse-integer value))
-8))))
(global-set-key (kbd "C-c h") 'to-hex)
Thanks,
snickerbockers
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#32252: i find binary-as-unsigned to be very helpful,
snickerbockers <=