>
>I just tested this. Using shifting vs. multiplication is faster with about 3/10000000 seconds.
>
The multiply is actually faster than the bitrshift. Probably due to the function call. I found that an empty UDF is 300% slower than a bitrshift and if you include an lparameters statement than the UDF is 700% slower.
>
>A good C/C++ compiler should optimize internally code that multiplies by 256 using a right shift, IMHO.
>
Your HO isn't far from Microsofts HO. Here is the assembly of a simple C++ app.
8: y = x * 256;
0040103C movsx eax,word ptr [x]
00401040 shl eax,8
00401043 mov word ptr [y],ax
Peter
Peter Stephens
Visual Records, Inc.
Lead Programmer for the general purpose record keeping system Visual Records. Written primarily in VFP 6.0 with a little C++.