ocehb: (Default)
[personal profile] ocehb
Типа: Features=0x183f9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8, SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR>



# perl -le '@a = map { "A$_" } 0..15; \
  print "<",join (",",grep { defined } \
  map { my $a = shift @a; $_ ? $a : undef } \
  split "", sprintf "%016b",$ARGV[0]),">";' 35600
<A0,A4,A6,A7,A11>

Date: 2006-09-29 10:34 am (UTC)
From: [identity profile] zhiraffanjut.livejournal.com
[Error: Irreparable invalid markup ('<scalar(0x8070c64),scalar(0x8070c70),scalar(0x8070c7c),scalar(0x8070c88),scalar(0x8070c94),scalar(0x8070ca0),scalar(0x8070cac),scalar(0x8070cb8),scalar(0x8070cc4),scalar(0x8070cd0),scalar(0x8070cdc),scalar(0x8070ce8),scalar(0x8070cf4),scalar(0x8070d00),scalar(0x8070d0c),scalar(0x8070d18)>') in entry. Owner must fix manually. Raw contents below.]

<SCALAR(0x8070c64),SCALAR(0x8070c70),SCALAR(0x8070c7c),SCALAR(0x8070c88),SCALAR(0x8070c94),SCALAR(0x8070ca0),SCALAR(0x8070cac),SCALAR(0x8070cb8),SCALAR(0x8070cc4),SCALAR(0x8070cd0),SCALAR(0x8070cdc),SCALAR(0x8070ce8),SCALAR(0x8070cf4),SCALAR(0x8070d00),SCALAR(0x8070d0c),SCALAR(0x8070d18)>


Непонятно...

Date: 2006-09-29 08:33 pm (UTC)
From: [identity profile] zhiraffanjut.livejournal.com
Не так красиво, но чуть короче:
  perl -le '$_ = sprintf("%016b",$ARGV[0]); s/(.)/$1?",A$-[0]":""/ge; \
    s/.//; print "<$_>\n";' 35600


или вообще вот так:

  perl -le 'sub f { @s = ($_[0]&1<<15) ? ("$_[2]$_[3]$_[1]",",A") : ($_[2],$_[3]);\
   ($_[1]<16) ? f($_[0]*2,$_[1]+1,@s) : "$s[0]>";} \
    print f(int($ARGV[0]), 0, "", "
[Error: Irreparable invalid markup ('<a");'>') in entry. Owner must fix manually. Raw contents below.]

Не так красиво, но чуть короче:
<pre>
perl -le '$_ = sprintf("%016b",$ARGV[0]); s/(.)/$1?",A$-[0]":""/ge; \
s/.//; print "<$_>\n";' 35600
</pre>

или вообще вот так:

<pre>
perl -le 'sub f { @s = ($_[0]&1<<15) ? ("$_[2]$_[3]$_[1]",",A") : ($_[2],$_[3]);\
($_[1]<16) ? f($_[0]*2,$_[1]+1,@s) : "$s[0]>";} \
print f(int($ARGV[0]), 0, "", "<A");' 35600
</pre>

Profile

ocehb: (Default)
ocehb

January 2021

S M T W T F S
     12
345 6789
10111213141516
17181920212223
24252627282930
31      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 7th, 2026 12:56 am
Powered by Dreamwidth Studios