|
|
hace 2 meses | |
|---|---|---|
| .. | ||
| Makefile | hace 5 meses | |
| README.md | hace 5 meses | |
| swap16.c | hace 2 meses | |
Echange d'octets 2 par 2 sur un fichier, en utilisant les intrinsics.
Sur un fichier texte:
echo '0123456789ABCDEF' > alpha
./swap16 --input alpha
Parsing: 17B.
Swab : 0.000 ms.
cat alpha
1032547698BADCFE%
Sur un fichier plus épais:
dd if=/dev/urandom of=/tmp/r.dummy bs=4M count=100
cp /tmp/r.dummy /tmp/r.true
./swap16 --input /tmp/r.dummy
Parsing: 400M.
Swab : 46.875 ms.
cmp /tmp/r.dummy /tmp/r.true
/tmp/r.dummy /tmp/r.true differ: char 1, line 1
./swap16 --input /tmp/r.dummy
Parsing: 400M.
Swab : 46.875 ms.
cmp /tmp/r.dummy /tmp/r.true
comparison avec dd:
dd if=/tmp/r.true of=/tmp/r.dd conv=swab
819200+0 records in
819200+0 records out
419430400 bytes transferred in 0.501462 secs (836414929 bytes/sec)
cmp /tmp/r.dummy /tmp/r.dd
Notez que dd est beaucoup fois plus lent.