Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
6
Task/Twos-complement/FreeBASIC/twos-complement-1.basic
Normal file
6
Task/Twos-complement/FreeBASIC/twos-complement-1.basic
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
Dim As Integer d1 = 2147483648, d2 = 2147483646
|
||||
Dim As Integer b(1 To ...) = {-d1, -d1+1, -2, -1, 0, 1, 2, d1-2, d1-1}
|
||||
For i As Integer = 1 To Ubound(b)
|
||||
Print b(i); " -> "; -b(i)
|
||||
Next i
|
||||
Sleep
|
||||
20
Task/Twos-complement/FreeBASIC/twos-complement-2.basic
Normal file
20
Task/Twos-complement/FreeBASIC/twos-complement-2.basic
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
Dim As Integer a = &b000011
|
||||
Dim As Integer a2c, l
|
||||
#ifdef __FB_64BIT__
|
||||
l = 16
|
||||
Asm
|
||||
mov rax, [a]
|
||||
neg rax
|
||||
mov [a2c], rax
|
||||
End Asm
|
||||
#else
|
||||
l = 8
|
||||
Asm
|
||||
mov eax, [a]
|
||||
neg eax
|
||||
mov [a2c], eax
|
||||
End Asm
|
||||
#endif
|
||||
|
||||
Print Bin(a, l); " -> "; Bin(a2c, l)
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue