aboutsummaryrefslogtreecommitdiff
path: root/challenge-119/james-smith/javascript/ch-1.js
blob: 4608fb09a17720dd27445465a299dca102869993 (plain)
1
2
3
4
5
6
7
8
9
TESTS = [ [101,86],[18,33] ];

TESTS.forEach(_ => console.log( swap_nibble( _[0] ) == _[1] ? 'OK' : '--' ) );
TESTS.forEach(_ => console.log( swap_nibble( _[1] ) == _[0] ? 'OK' : '--' ) );

function swap_nibble(_) {
  return (_>>4) | ((_&15)<<4);
}