[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to automatically increment an index array
From: |
David Kastrup |
Subject: |
Re: How to automatically increment an index array |
Date: |
Fri, 27 Jun 2008 10:19:36 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
Thien-Thi Nguyen <ttn@gnuvola.org> writes:
> () David Kastrup <dak@gnu.org>
> () Fri, 27 Jun 2008 08:50:35 +0200
>
> Well, one could write something like
>
> C-M-% \[0x\([0-9a-f]+\)\] RET \,(format "[%08x]" (+ (* 4
> (string-to-number \1 16)) #X8745b400)) RET
>
> It is not all too pretty, but not all too bad either. If the
> pattern of the numbers is regular, you might use \# in the
> replacement rather than an explicit conversion.
>
> Although the general approach is sound, in this case
> the #x8745b400 will be silently truncated on a 32-bit host.
Oops.
> To workaround, one can hardformat the high hex digits:
>
> (format "[8745%04x]" (... #xb400))
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum