Sujet : Re: xxd -i vs DIY Was: C23 thoughts and opinions
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 03. Jun 2024, 08:49:00
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v3jshc$3q731$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
User-Agent : Pan/0.158 (Avdiivka; )
On Wed, 29 May 2024 21:31:54 +0100, bart wrote:
Conclusion: beating xxd is apparently not hard if even a scripting
language can do so. I wonder what slows it down?
It’s written in a very stdio-dependent vanilla C style.
Have a look at the source for yourself. It’s part of the “vim” package on
Debian and no doubt other distros. The xxd binary itself is built from a
single source file of just some 1200 lines, and the hex-to-binary
conversion is done in a function called “huntype” of just 133 lines.