Page 1 of 1

Posted: Wed Apr 17, 2002 1:33 pm
by BackupUser
Restored from previous forum. Originally posted by tex.

Hi,

How to use the "shl" ASM instruction.

For the moment, i emulate the SHL like this: (and it's very, very slow

Code: Select all

 
Procedure  shl(value,bit)
 For x = 1 To bit
 value * 2
Next
ProcedureReturn value 
EndProcedure


Repeat ; debug window


 a= shl (Random (10),2)

 b= shl (5,8)
 Delay (100)
ForEver
Thanks for your help, TEX



[url]mailto:texmex@cybercable.fr[/url]

Posted: Wed Apr 17, 2002 2:00 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.
Hi,

How to use the "shl" ASM instruction.

For the moment, i emulate the SHL like this: (and it's very, very slow

Code: Select all

 
Procedure  shl(value,bit)
 For x = 1 To bit
 value * 2
Next
ProcedureReturn value 
EndProcedure


Repeat ; debug window


 a= shl (Random (10),2)

 b= shl (5,8)
 Delay (100)
ForEver
Thanks for your help, TEX



[url]mailto:texmex@cybercable.fr[/url]

There are easier ways, use the '>' operators.
example:

Code: Select all

a = b>3 ; shift down b 3 steps and store result in 'b'

Posted: Wed Apr 17, 2002 2:33 pm
by BackupUser
Restored from previous forum. Originally posted by tex.

great !!!

too easy

and thanks
Hi,

How to use the "shl" ASM instruction.

For the moment, i emulate the SHL like this: (and it's very, very slow

Code: Select all

 
Procedure  shl(value,bit)
 For x = 1 To bit
 value * 2
Next
ProcedureReturn value 
EndProcedure


Repeat ; debug window


 a= shl (Random (10),2)

 b= shl (5,8)
 Delay (100)
ForEver
Thanks for your help, TEX



[url]mailto:texmex@cybercable.fr[/url]

There are easier ways, use the '>' operators.
example:

Code: Select all

a = b>3 ; shift down b 3 steps and store result in 'b'

Posted: Wed Apr 17, 2002 2:42 pm
by BackupUser
Restored from previous forum. Originally posted by skypa.

And the easiest way :

Just take 'SAL' with inline Assembler. SAL is equal to SHL, only the NASM Syntax.

--
SAL EAX, 7
--



skypa

Posted: Wed Apr 17, 2002 4:35 pm
by BackupUser
Restored from previous forum. Originally posted by tex.

perhaps more speed...

thanks


And the easiest way :

Just take 'SAL' with inline Assembler. SAL is equal to SHL, only the NASM Syntax.

--
SAL EAX, 7
--



skypa



Posted: Wed Apr 17, 2002 6:14 pm
by BackupUser
Restored from previous forum. Originally posted by fred.

And THE easier way:

a*2 ; this is like a << 1 or SAL a,2 or anything.

PureBasic is an Optimizing compiler, which mean than all operations (for example this multiplication) will be changed with faster command when possible.

Fred - AlphaSND