Re: Little\Big-Endian Single and Double values
From: Mike D Sutton (EDais_at_mvps.org)
Date: 11/18/04
- Next message: shachar: "help with datagrid"
- Previous message: Jan Hyde: "Re: how to wrap Listbox sorted property"
- In reply to: Francesco Ranieri: "Re: Little\Big-Endian Single and Double values"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 18 Nov 2004 12:07:40 -0000
> Thanks Mike... your suggestion helps always very much!
> I've seen your code and it seems to me that you flip, simply, all bytes.
> I see you're very skilled and I wish you examine this code in order to receive an your advice about:
<code snipped>
> This code should be perform the same operations of yours... without loops!
> I've tryed to execute your code and mine... the result are the same!
>
> Do you think I'm right and...."important" for me.... my code (without loop...)
> could be slightly faster than your approach (...with loop)??????
More than likely not since you're performing many superfluous copies of the data where as my version uses the data in-place. For
the FlipFloat() and FlipDouble() methods you could unwrap the internal loop if you wish which would slightly optimise the code but
to be honest you're very unlikely to notice the difference unless you're calling this a _lot_ and you've previously identified it as
being a bottleneck in your application (and you'd have to re-code the method for each type you wanted to flip, the FlipBytes()
method is generic for any type since it simply takes pointers directly.)
> It seems to me that FlipBytes function executes the same operation of NToH\HToNL.. isn't it really?
> I've found, also, your code to substitute the NToH\HToNL functions in an older post:
<code snipped>
> and, Donald Lessau has discovered that your code is faster than others approaches and... some more
> than NToH\HToNL functions!!!!!
> I think that I'll use your variant instead NToH\HToNL for my purpose!!!
Yep, masking and shifting the bytes in pure VB code is faster than calling the API calls since there's not the overhead of calling
to the DLL, if the VB compiler is at all optimised it should convert those multiplications and divides to shift operations anyway
which will be what the API calls are doing internally anyway.
Hope this helps,
Mike
- Microsoft Visual Basic MVP -
E-Mail: EDais@mvps.org
WWW: http://EDais.mvps.org/
- Next message: shachar: "help with datagrid"
- Previous message: Jan Hyde: "Re: how to wrap Listbox sorted property"
- In reply to: Francesco Ranieri: "Re: Little\Big-Endian Single and Double values"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|