Re: Byte swapping efficiently
- From: John Hatpin <noone@xxxxxxxxxxx>
- Date: Wed, 03 May 2006 14:59:14 +0100
On Mike D Sutton wrote:
[...]
Private Function FlipWordB(ByVal inWord As Integer) As Integer ' Endian swap[...]
on Word
FlipWordB = ((inWord And &H7F) * &H100) Or (((inWord And &HFF00) \
&H100) And &HFF)
If (inWord And &H80) Then FlipWordB = FlipWordB Or &H8000
End Function
Looks like FlipWordE() in the IDE, and FlipWordB() or FlipWordG() compiled
are the ones to go for if performance is your goal.
Hope this helps,
It does indeed help - many thanks, Mike (again - we must stop meeting
like this) and thanks also to others who responded.
Plugged into the app (and noting the \ is a /), it does make a
noticeable difference, although not as much as I'd hoped. However,
it's shifted the bottleneck away from byte-swapping, which was the
hoped outcome - it's now the simple mechanics of processing 55MB of
data that's holding the app up, but performance is now acceptable.
Incidentally, I've changed the function to return a Single, since
that's the data type expected by the calling routine.
For what it's worth, this is USGS GTOPO30 global elevation data, which
is chunked into usable sections and rendered to BMP for use in a
map-based interface in another part of the app.
--
John Hatpin
.
- Follow-Ups:
- Re: Byte swapping efficiently
- From: Karl E. Peterson
- Re: Byte swapping efficiently
- References:
- Byte swapping efficiently
- From: John Hatpin
- Re: Byte swapping efficiently
- From: Mike D Sutton
- Byte swapping efficiently
- Prev by Date: Re: PDF API: Loop through each object in PDF file
- Next by Date: Re: Using with
- Previous by thread: Re: Byte swapping efficiently
- Next by thread: Re: Byte swapping efficiently
- Index(es):
Relevant Pages
|
Loading