[webkit-reviews] review granted: [Bug 98054] Add htons/htonl definitions and implementations : [Attachment 166705] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 2 10:13:55 PDT 2012


Darin Adler <darin at apple.com> has granted Joshua Bell <jsbell at chromium.org>'s
request for review:
Bug 98054: Add htons/htonl definitions and implementations
https://bugs.webkit.org/show_bug.cgi?id=98054

Attachment 166705: Patch
https://bugs.webkit.org/attachment.cgi?id=166705&action=review

------- Additional Comments from Darin Adler <darin at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=166705&action=review


If this really is giving us measurably better performance, than it seems fine
to land it.

> Source/WTF/wtf/ByteOrder.h:61
> +#if CPU(BIG_ENDIAN)
> +#define ntohs(x) ((uint16_t)(x))
> +#define htons(x) ((uint16_t)(x))
> +#define ntohl(x) ((uint32_t)(x))
> +#define htonl(x) ((uint32_t)(x))
> +#elif CPU(MIDDLE_ENDIAN)
> +#define ntohs(x) ((unit16_t)(x))
> +#define htons(x) ((uint16_t)(x))
> +#define ntohl(x) WTF::Internal::wswap32(x)
> +#define htonl(x) WTF::Internal::wswap32(x)
> +#else
> +#define ntohs(x) WTF::Internal::bswap16(x)
> +#define htons(x) WTF::Internal::bswap16(x)
> +#define ntohl(x) WTF::Internal::bswap32(x)
> +#define htonl(x) WTF::Internal::bswap32(x)
> +#endif

Do these need to be macros rather than inline functions?


More information about the webkit-reviews mailing list