Uint64 = ccSHR(Target:Uint64,OPT CandC = 32:Word/or Word ByRef)
Uint64 = ccSHL(Target:Uint64,OPT CandC = 32:Word/or Word ByRef)
.--.
.------------------.
.--.
|C |------>|63 ----------> 0 |------>|C|
._.
'------------------'
'--'
.--.
.------------------.
.--.
|C |<------|63 ----------> 0 |<------|C |
._.
'------------------'
'--'
CandC = CandC|Carry << 9
Target - Variable which bits will be shifted.
CandC - Counter for the bits being shifted.
A Uint64 Shifted
'CandC' will contain 'CandC' and in it's 8-th bit the value of the last bit shifted out
Sample:
By bit 8 = 1 of 'CandC' ccSHL("....00001",2) will result "....00111"
ccSHR("1000....",2) = > "1110....."
To get the Carry use Carry = CandC >> 8
And you have to give the 'CandC' Byref!!!
Like :
R = ccSHR(R,&CandC)
The standard value for 'CandC' is 32 to easily get the low/high part of a UInt64.
R = ccSHL(R,S)
R = ccSHR(R,3)
See
Logics_Demo.eba