[Patches] [ python-Patches-717102 ] Fetch oparg with unsigned short

SourceForge.net noreply@sourceforge.net
Thu, 10 Apr 2003 09:22:42 -0700


Patches item #717102, was opened at 2003-04-07 18:16
Message generated for change (Settings changed) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=717102&group_id=5470

Category: Core (C code)
Group: Python 2.3
>Status: Closed
>Resolution: Wont Fix
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Raymond Hettinger (rhettinger)
Summary: Fetch oparg with unsigned short

Initial Comment:
This is faster than retrieving two unsigned chars and 
assembling them with a shift and bitwise-or.

Wrapped in a conditional macro because the 
transformation only works for little endian 
architectures.

Tim, is there something better than MS_WINDOWS to 
test for a little endian environment?

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2003-04-07 20:32

Message:
Logged In: YES 
user_id=31435

You could write an autoconfig test to determine the 
endianness of the box, and then builds for non-Unix 
platforms would need to define the symbol (or not) by 
hand.  We do that for lots of stuff already.  In fact, I'm 
pretty sure autoconf already generates endian info.

I discourage using this, though.  HW-related ifdefs are a 
nightmare to maintain over time, and an optimizing 
compiler should be smart enough to do this transformation 
on its own -- provided it's really a win on the platform at 
hand.  The architecture trend is toward penalizing unaligned 
access of all kinds, and if you didn't test this under every 
flavor of Pentium that has been, and ever will be, released, 
you don't know all its effects on speed.  That's why HW-
related ifdefs become a nightmare over time.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=717102&group_id=5470