Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, August 2007
Reverse a Byte


Message 1 in thread

I am reading blobs out of a database and I realized that I'll need to
reverse them for PPC machines.  Is there a quick and easy way to do
this in Qt?

Thanks in advance...

--
 [ signature omitted ] 

Message 2 in thread

Willy P schrieb:
> I am reading blobs out of a database and I realized that I'll need to
> reverse them for PPC machines.  Is there a quick and easy way to do
> this in Qt?

You don't want to reverse a single byte ("Reverse a byte"). You want to 
swap the byte order (from Little Endian (Intel) to Big Endian (PPC)). 
And you want to look at this:

   http://doc.trolltech.com/4.3/qtglobal.html#qFromBigEndian

and similar functions.

;)

Cheers, Oliver

--
 [ signature omitted ] 

Message 3 in thread

Ahhh, thanks.  I am running 4.2.2 so I wasn't aware of those
functions. Perhaps it's time to do that update...




On 8/16/07, Till Oliver Knoll <oliver.knoll@xxxxxxxxxxx> wrote:
> Willy P schrieb:
> > I am reading blobs out of a database and I realized that I'll need to
> > reverse them for PPC machines.  Is there a quick and easy way to do
> > this in Qt?
>
> You don't want to reverse a single byte ("Reverse a byte"). You want to
> swap the byte order (from Little Endian (Intel) to Big Endian (PPC)).
> And you want to look at this:
>
>    http://doc.trolltech.com/4.3/qtglobal.html#qFromBigEndian
>
> and similar functions.
>
> ;)
>
> Cheers, Oliver
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>

--
 [ signature omitted ] 

Message 4 in thread

This functionality has been there for a long time.  Finding it in the
docs, when you don't know where it is... is another issue :)

#include <QEndian>


Scott



> -----Original Message-----
> From: Willy P [mailto:willy.lists@xxxxxxxxx]
> Sent: Thursday, August 16, 2007 10:25 AM
> To: Till Oliver Knoll
> Cc: Qt Interest List
> Subject: Re: Reverse a Byte
> 
> Ahhh, thanks.  I am running 4.2.2 so I wasn't aware of those
> functions. Perhaps it's time to do that update...
> 
> 
> 
> 
> On 8/16/07, Till Oliver Knoll <oliver.knoll@xxxxxxxxxxx> wrote:
> > Willy P schrieb:
> > > I am reading blobs out of a database and I realized that I'll need
to
> > > reverse them for PPC machines.  Is there a quick and easy way to
do
> > > this in Qt?
> >
> > You don't want to reverse a single byte ("Reverse a byte"). You want
to
> > swap the byte order (from Little Endian (Intel) to Big Endian
(PPC)).
> > And you want to look at this:
> >
> >    http://doc.trolltech.com/4.3/qtglobal.html#qFromBigEndian
> >
> > and similar functions.
> >
> > ;)
> >
> > Cheers, Oliver
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx
with
> "unsubscribe" in the subject or the body.
> > List archive and information:
http://lists.trolltech.com/qt-interest/
> >
> >
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 5 in thread

Scott Aron Bloom schrieb:
> This functionality has been there for a long time.  Finding it in the
> docs, when you don't know where it is... is another issue :)
> 
> #include <QEndian>

 From the docs (qFromBigEndian): "This function was introduced in Qt 4.3."

It's well possible that qFromBigEndian() etc. where inside Qt before, 
but at least not "officially" ;)

Cheers, Oliver

--
 [ signature omitted ] 

Message 6 in thread

> From: Till Oliver Knoll [mailto:oliver.knoll@xxxxxxxxxxx]
> Sent: Friday, August 17, 2007 5:43 AM
> To: Qt Interest List
> Subject: Re: Reverse a Byte
> 
> Scott Aron Bloom schrieb:
> > This functionality has been there for a long time.  Finding it in
the
> > docs, when you don't know where it is... is another issue :)
> >
> > #include <QEndian>
> 
>  From the docs (qFromBigEndian): "This function was introduced in Qt
4.3."
> 
> It's well possible that qFromBigEndian() etc. where inside Qt before,
> but at least not "officially" ;)
> 
> Cheers, Oliver

That's funny... I had used something from QT in a 3.3 app 3+ years ago..

I wonder if it was a hidden function that they finally made public...

Scott

--
 [ signature omitted ] 

Message 7 in thread

You don't happen to remember where you found that in Qt 3.3 do you?  I'm
don't see it listed in the docs, so maybe I'll have to dive into the
source!

Sean

-----Original Message-----
From: Scott Aron Bloom [mailto:scott@xxxxxxxxxxxx]
Sent: Friday, August 17, 2007 10:39 AM
To: Till Oliver Knoll; Qt Interest List
Subject: RE: Reverse a Byte

> From: Till Oliver Knoll [mailto:oliver.knoll@xxxxxxxxxxx]
> Sent: Friday, August 17, 2007 5:43 AM
> To: Qt Interest List
> Subject: Re: Reverse a Byte
> 
> Scott Aron Bloom schrieb:
> > This functionality has been there for a long time.  Finding it in
the
> > docs, when you don't know where it is... is another issue :)
> >
> > #include <QEndian>
> 
>  From the docs (qFromBigEndian): "This function was introduced in Qt
4.3."
> 
> It's well possible that qFromBigEndian() etc. where inside Qt before, 
> but at least not "officially" ;)
> 
> Cheers, Oliver

That's funny... I had used something from QT in a 3.3 app 3+ years ago..

I wonder if it was a hidden function that they finally made public...

Scott

--
 [ signature omitted ] 

Message 8 in thread

I don't think it's in Qt 3.3 - at least not in Qt 3.3.6

It's been there a long while in Qt 4 - it just has been undocumented
until recently.

Maybe Scott was referring to qSysInfo: a function that would tell you if
you're on bigendian, but it doesnt do any actual translation.

Cheers,
Peter

> -----Original Message-----
> From: Murphy, Sean M. [mailto:sean.murphy@xxxxxxxxxx] 
> Sent: Friday, August 17, 2007 5:02 PM
> To: Qt Interest List
> Subject: RE: Reverse a Byte
> 
> 
> You don't happen to remember where you found that in Qt 3.3 
> do you?  I'm
> don't see it listed in the docs, so maybe I'll have to dive into the
> source!
> 
> Sean

--
 [ signature omitted ] 

Message 9 in thread

I'm pretty sure I had used it in 3.3.X but that project was converted to
a 4.2 project about 6-8 months ago... and I havnt touched 3.3.X since.

Ill go search through some old code and see... It may have been one of
those "hey this is cool unexposed code... let me cut and paste it"

If I remember... it was part of the QDataStream area

Scott

> -----Original Message-----
> From: Peter Prade [mailto:prade@xxxxxxxxxxx]
> Sent: Friday, August 17, 2007 9:05 AM
> To: Qt Interest List
> Subject: RE: Reverse a Byte
> 
> I don't think it's in Qt 3.3 - at least not in Qt 3.3.6
> 
> It's been there a long while in Qt 4 - it just has been undocumented
> until recently.
> 
> Maybe Scott was referring to qSysInfo: a function that would tell you
if
> you're on bigendian, but it doesnt do any actual translation.
> 
> Cheers,
> Peter
> 
> > -----Original Message-----
> > From: Murphy, Sean M. [mailto:sean.murphy@xxxxxxxxxx]
> > Sent: Friday, August 17, 2007 5:02 PM
> > To: Qt Interest List
> > Subject: RE: Reverse a Byte
> >
> >
> > You don't happen to remember where you found that in Qt 3.3
> > do you?  I'm
> > don't see it listed in the docs, so maybe I'll have to dive into the
> > source!
> >
> > Sean
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/

--
 [ signature omitted ] 

Message 10 in thread

Scott Aron Bloom schrieb:
> ...
> If I remember... it was part of the QDataStream area

I think I had seen some static functions doing byte swapping, but that 
was somewhere in qfont.cpp or qfontdatabase.cpp ... ;)


Cheers, Oliver

--
 [ signature omitted ] 

Message 11 in thread

To swap a single byte to have MSbit in place of LSbit, the fastest way is to 
write a bitswapTable; i.e. an array of 256 byte making the swap function.

Regards

Alle 19:02, giovedì 16 agosto 2007, Willy P ha scritto:
> I am reading blobs out of a database and I realized that I'll need to
> reverse them for PPC machines.  Is there a quick and easy way to do
> this in Qt?
>
> Thanks in advance...
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/

-- 
 [ signature omitted ]