aboutsummaryrefslogtreecommitdiff
path: root/challenge-119/abigail/ruby/ch-1.rb
blob: f41b55ae48986563e359d2da6d76b69752a55027 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/ruby

#
# See ../README.md
#
 
#
# Run as: ruby ch-1.rb < input-file
#

ARGF . each_line do
    |line|
    num = line . to_i
    puts ( (num & ~0xFF)      \
         | (num &  0x0F) << 4 \
         | (num &  0xF0) >> 4)
end