A
A
a2018-03-21 21:40:01
Delphi
a, 2018-03-21 21:40:01

How to change the order of bits in Pascal in a byte?

Let's say:

b:=$C9; // 1100 1001
b:=...; // какие-то побитные операции
writeln(b);

The result should be 1001 0011 = $93 = 147
But conditions and loops are not allowed

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sumor, 2018-03-21
@DanKruit

You can just vlob:

b:= (b and $80 shr 7) or (b and $40 shr 5) or (b and $20 shr 3) or (b and $10 shr 1) or 
    (b and $08 shl 1) or (b and $04 shl 3) or (b and $02 shl 5) or (b and $01 shl 7);

K
Konstantin Tsvetkov, 2018-03-21
@tsklab

Use a spreadsheet.
Or use ROL assembler .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question