Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
29
Task/Bitwise-operations/PureBasic/bitwise-operations.basic
Normal file
29
Task/Bitwise-operations/PureBasic/bitwise-operations.basic
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
Procedure Bitwise(a, b)
|
||||
Debug a & b ; And
|
||||
Debug a | b ;Or
|
||||
Debug a ! b ; XOr
|
||||
Debug ~a ;Not
|
||||
Debug a << b ; shift left
|
||||
Debug a >> b ; arithmetic shift right
|
||||
; Logical shift right and rotates are not available
|
||||
; You can of use inline ASM to achieve this:
|
||||
Define Temp
|
||||
; logical shift right
|
||||
!mov edx, dword [p.v_a]
|
||||
!mov ecx, dword [p.v_b]
|
||||
!shr edx, cl
|
||||
!mov dword [p.v_Temp], edx
|
||||
Debug Temp
|
||||
; rotate left
|
||||
!mov edx, dword [p.v_a]
|
||||
!mov ecx, dword [p.v_b]
|
||||
!rol edx, cl
|
||||
!mov dword [p.v_Temp], edx
|
||||
Debug Temp
|
||||
; rotate right
|
||||
!mov edx, dword [p.v_a]
|
||||
!mov ecx, dword [p.v_b]
|
||||
!ror edx, cl
|
||||
!mov dword [p.v_Temp], edx
|
||||
Debug Temp
|
||||
EndProcedure
|
||||
Loading…
Add table
Add a link
Reference in a new issue