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

SourceForge.net noreply@sourceforge.net
Mon, 07 Apr 2003 18:32:21 -0700


Patches item #717102, was opened at 2003-04-07 19:16
Message generated for change (Comment added) made by tim_one
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: Open
Resolution: None
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 21: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