Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bitwise Operations
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00671926
Message ID:
00672384
Vues:
12
Thanks, I already found a sample to work with on the net (can't remember where though).

>Nigel,
>
>>I need to create an object to wrap around the Crypto API and am having trouble converting an existing object (VFP).
>
>There is a number of Crypto API wrapper on sites like www.planet-source-code.com. You can also download a CAPICOM from MS site.
>
>>Does anybody know how I can right- or left- shift bits?
>
>The author of this code is Fredrik Qvarfort:
>
>Private Function lBSL(ByRef lInput As Long, ByRef bShiftBits As Byte) As Long
>
>  lBSL = (lInput And (2 ^ (31 - bShiftBits) - 1)) * 2 ^ bShiftBits
>  If (lInput And 2 ^ (31 - bShiftBits)) = 2 ^ (31 - bShiftBits) Then lBSL = (lBSL Or &H80000000)
>
>End Function
>Private Function lBSR(ByRef lInput As Long, ByRef bShiftBits As Byte) As Long
>
>  If (bShiftBits = 31) Then
>    If (lInput < 0) Then lBSR = &HFFFFFFFF Else lBSR = 0
>  Else
>    lBSR = (lInput And Not (2 ^ bShiftBits - 1)) \ 2 ^ bShiftBits
>  End If
>
>End Function
>
>Private Function lBSRU(lInput As Long, bShiftBits As Byte) As Long
>
>  If (bShiftBits = 31) Then
>    lBSRU = -(lInput < 0)
>  Else
>    lBSRU = (((lInput And Not (2 ^ bShiftBits - 1)) \ 2 ^ bShiftBits) And Not (&H80000000 + (2 ^ bShiftBits - 2) * 2 ^ (31 - bShiftBits)))
>  End If
>
>End Function
>
Nigel B Coates
NBC Software Services
Dublin, Ireland.
eMail: Nigel.Coates@NBCSoftware.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform