FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
Shift for bits
Shift for bits
Débuté par Marco Rego.pcs.crosspost, 28 aoû. 2008 01:56 - 1 réponse
Connectez-vous…
Marco Rego.pcs.crosspost
#1
Posté le 28 août 2008 - 01:56
Are there any shift left and right related functions for dealing with bits ?
Just found BinaryAND/OR/XOR and it is not exactly what I am looking for.
Message forwarded from pcsoft.us.windev
Signaler
0
0
BLS
#2
Posté le 28 août 2008 - 01:56
Marco Rego :
Are there any shift left and right related functions for dealing with bits ?
Just found BinaryAND/OR/XOR and it is not exactly what I am looking for.
Hi Marco,
NO, it's a shame but WD has no (or pretty less) support for bit-wise operations.
However code for shiftleft > , enjoy.
Procedure
ShiftLeft
(
n
Int
,
n
BitsToShift
)
n
Result is
int
WHEN EXCEPTION
ExceptionEnable
(
)
RESULT
-
1
END
n
Result
=
n
Int
*
Power
(
2
,
n
BitsToShift
)
RESULT
n
Result
FUNCTION
ShiftRight
(
n
Int
,
n
BitsToShift
)
n
Retval is
int
WHEN EXCEPTION
// Capacity Error
ExceptionEnable
(
)
RESULT
-
1
END
n
Retval
=
n
Int
/
Power
(
2
,
n
BitsToShift
)
RESULT
n
Retval
PS ..the lack of bit operations in WD is quit annoying. So I wrote all "low level" code in the D programming language. [means create a DLL]
Beside ... can't resist :
(D is in fact C++ on steroids, without being too complicated, at least ...compared to C++
)
http://www.digitalmars.com/d/
HTH Bjoern
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte