[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Byte order conversions
From: Szombathelyi_György <gyurco () freemail ! hu>
Date: 2004-10-27 13:28:05
Message-ID: 417FA265.7090709 () freemail ! hu
[Download RAW message or body]
Thiago Macieira wrote:
> Szombathelyi György wrote:
>
>>Is there anyone who knows convenient byte-order conversion functions in
>>QT/kdelibs? If not, then what about adding some functions like
>>{be2me,le2me,me2be,me2le}_{16,32,64) (prefixed with the usual 'K')?. As
>>I browse through the code, every piece of code which requires this
>>functionality implements its own solution, usually with ugly macros and
>>#ifdef WORDS_BIGENDIAN conditionals.
>
>
> htons, htonl, ntohs, ntohl should do the big-endian to machine-endian stuff.
>
And my Linux machines have byteswap.h, which does 64 bit, too. However I
guess, these aren't too portable. I can think of a wrapper header file
which encapsulates the functionality in some easy-to-use macros. The
implementation checks for bswap_xx functions (in byteswap.h), if not
found then {h|n}toxx functions (in netinet/in.h or something that the
BSD folks likes, too), and if neither present implement these with some
custom code. Or any better idea?
Bye,
György
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic