mirror of
https://github.com/mi57730/a2d.git
synced 2024-11-25 10:30:50 +00:00
13 lines
304 B
Perl
Executable File
13 lines
304 B
Perl
Executable File
#!/usr/bin/env perl
|
|
|
|
# Convert $xx into px(bbbbbbb) - MGTK pattern/bits
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
while (<STDIN>) {
|
|
s/(\$([0-7][0-9A-F])\b)/'px(%' . reverse(sprintf('%07b', hex($2))) . ')'/ieg;
|
|
s/(\$([89A-F][0-9A-F])\b)/'PX(%' . reverse(sprintf('%07b', 0x7f & hex($2))) . ')'/ieg;
|
|
print;
|
|
}
|