New topic: 

More questions about MemoryBlock.

<http://forums.realsoftware.com/viewtopic.php?t=29680>

       Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic         Author  
Message       JustSomeGuy           Post subject: More questions about 
MemoryBlock.Posted: Fri Aug 21, 2009 1:05 pm                               
Joined: Fri May 11, 2007 11:35 am
Posts: 456              I have a block of memory that can contain, 8, 16, 32 or 
64, or RGB data.  (Read in from a file object)
I need to be able to perform byte swapping on the memory block contents. 
(Depending on the endianism of the file and the endianism of the system)
How can I go about doing this?  (I know how to check the systems and files 
endianism, but not how to perform the byte swapping.)

To be sure you understand:
if the MB contains 8 bit data, well no byte swapping is necessary
if the MB contains 16 bit data then ever two bytes needs byte swapping
if it contains 32 bit data then 3 swaps are needed per element.     
_________________
A picture paints a thousand words.
A thought paints a thousand pictures.  
                            Top               Steve Garman           Post 
subject: Re: More questions about MemoryBlock.Posted: Fri Aug 21, 2009 1:34 pm  
                             
Joined: Fri Sep 30, 2005 3:53 pm
Posts: 2926
Location: England              Are you sure you need to do your own byte 
swapping?

Are you aware of the MemoryBlock LittleEndian property?     
_________________
Steve Garman
Using REALbasic 2008r2 Professional on Windows Vista Ultimate
and REALbasic 2009r3 Professional on Linux Ubuntu 9.04 Desktop
Occasional blog  
                            Top               JustSomeGuy           Post 
subject: Re: More questions about MemoryBlock.Posted: Fri Aug 21, 2009 1:49 pm  
                             
Joined: Fri May 11, 2007 11:35 am
Posts: 456              Steve Garman wrote:Are you sure you need to do your own 
byte swapping?
Are you aware of the MemoryBlock LittleEndian property?

I understand that there is a littleendian property.
But how does that help me?  how does MemoryBlock know if it needs to do 16, 32 
or 64 bit byte swapping?
Perhaps you are thinking I am adding one element at a time to the memory block 
rather than reading the whole block from file into the memory block?
Of perhaps you are saying that I should set the endianism and just leave the 
memory in its state and as I remove elements the byte swapping will be done for 
me if necessary?     
_________________
A picture paints a thousand words.
A thought paints a thousand pictures.  
                            Top           Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]     
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to