Saros
Messages postés921Date d'inscriptionvendredi 20 décembre 2002StatutMembreDernière intervention23 septembre 2010 21 déc. 2004 à 18:39
C'est marrant :)
Afyn
Messages postés608Date d'inscriptionsamedi 3 août 2002StatutMembreDernière intervention22 décembre 2016 19 déc. 2004 à 11:14
Si tu veux gagner quelques cycles sur le processeur...
(Mais on gagne rien sur la taille, le compilateur
doit optimiser pas mal ...)
tu peux essayer ce genre de chose :
' Procédure de mise à jour de l'horloge
Private Sub Timer_Timer()
Dim i As Long
Heure = Hour(Time)
Mins = Minute(Time)
Secs = Second(Time)
For i = 1 To 6
Select Case i
Case 1
Magic = 32
MagicH = 16
Case 2
Magic = 16
MagicH = 8
Case 3
Magic = 8
MagicH = 4
Case 4
Magic = 4
MagicH = 2
Case 5
Magic = 2
MagicH = 1
Case 6
Magic = 1
End Select
' Calcul Minutes
booMins = Mins \ Magic ' Calcul du bit
If Mins >Magic Then Mins Mins - Magic
If booMins Then ' Afficher l'état du bit
imgMins(i).Picture = imgBin1.Picture
Else
imgMins(i).Picture = imgBin0.Picture
End If
' Calcul Secondes
booSecs = Secs \ Magic ' Calcul du bit
If Secs >Magic Then Secs Secs - Magic
If booSecs Then ' Afficher l'état du bit
imgSecs(i).Picture = imgBin1.Picture
Else
imgSecs(i).Picture = imgBin0.Picture
End If
If i = 6 Then Exit Sub
' Calcul Heures
booHeure = Heure \ MagicH ' Calcul du bit
If Heure >MagicH Then Heure Heure - MagicH
If booHeure Then ' Afficher l'état du bit
imgHeure(i).Picture = imgBin1.Picture
Else
imgHeure(i).Picture = imgBin0.Picture
End If
Next i
21 déc. 2004 à 18:39
19 déc. 2004 à 11:14
(Mais on gagne rien sur la taille, le compilateur
doit optimiser pas mal ...)
tu peux essayer ce genre de chose :
' Procédure de mise à jour de l'horloge
Private Sub Timer_Timer()
Dim i As Long
Heure = Hour(Time)
Mins = Minute(Time)
Secs = Second(Time)
For i = 1 To 6
Select Case i
Case 1
Magic = 32
MagicH = 16
Case 2
Magic = 16
MagicH = 8
Case 3
Magic = 8
MagicH = 4
Case 4
Magic = 4
MagicH = 2
Case 5
Magic = 2
MagicH = 1
Case 6
Magic = 1
End Select
' Calcul Minutes
booMins = Mins \ Magic ' Calcul du bit
If Mins >Magic Then Mins Mins - Magic
If booMins Then ' Afficher l'état du bit
imgMins(i).Picture = imgBin1.Picture
Else
imgMins(i).Picture = imgBin0.Picture
End If
' Calcul Secondes
booSecs = Secs \ Magic ' Calcul du bit
If Secs >Magic Then Secs Secs - Magic
If booSecs Then ' Afficher l'état du bit
imgSecs(i).Picture = imgBin1.Picture
Else
imgSecs(i).Picture = imgBin0.Picture
End If
If i = 6 Then Exit Sub
' Calcul Heures
booHeure = Heure \ MagicH ' Calcul du bit
If Heure >MagicH Then Heure Heure - MagicH
If booHeure Then ' Afficher l'état du bit
imgHeure(i).Picture = imgBin1.Picture
Else
imgHeure(i).Picture = imgBin0.Picture
End If
Next i
End Sub
Bonne prog ... A+
Afyn
Navedac