[Python-ideas] IntFlags
random832 at fastmail.us
random832 at fastmail.us
Thu Mar 5 16:58:44 CET 2015
More information about the Python-ideas mailing list
Thu Mar 5 16:58:44 CET 2015
- Previous message (by thread): [Python-ideas] IntFlags
- Next message (by thread): [Python-ideas] IntFlags
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Mar 4, 2015, at 18:19, Andrew Barnert wrote: > Think about how that extends to the result of |. The value is either negative (is the complement of a finite set of bits) or it isn't. Remember, the underlying representation is an int. Of course the answer > depends on how you store ~ in the first place, but for most choices, str > is not obvious. For example, using fixed-size unsigned with automatic > highest-bit detection, for an enum with READ, WRITE, EXEC, STICKY, > ~(READ) is the same value as (WRITE|EXEC|STICKY), Why would that be the case? > Yeah, open flags are especially screwy, where flags & 3 has a special > non-bitmapped meaning but the rest of the bits are flags. There are other > cases where multiple ints, only some of which are bitmaps, are packed as > separate bitfields into the same int (e.g., TCP/IP headers), but I don't > know of any others that pretend to be a single bitmap even though they > aren't, so that's really a unique problem, which can be ignored. Technically file modes have the file type field (flags & 0xF000) which has some states that don't mean anything on common platforms.
- Previous message (by thread): [Python-ideas] IntFlags
- Next message (by thread): [Python-ideas] IntFlags
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list