develooper Front page | perl.perl5.porters | Postings from February 2017

Re: Apparent 4 avail bits in SV flags

Thread Previous
Karl Williamson
February 9, 2017 22:24
Re: Apparent 4 avail bits in SV flags
Message ID:
On 02/09/2017 02:06 PM, Leon Timmermans wrote:
> On Thu, Feb 9, 2017 at 1:29 AM, Karl Williamson <
> <>> wrote:
>     It looks to me, and others on #p5p that there are 4 unused bits in
>     the flags for an SV.
>     The types take up 4 bits, but then the actual flags, like SVf_IOK,
>     start at 0x100.  That apparently means bits  matching the mask 0xF0
>     are available.  Are we wrong?
> "He guessed as well as he could, and crawled along for a good way, till
> suddenly his hand met what felt like a tiny ring of cold metal lying on
> the floor of the tunnel. It was a turning point in his career, but he
> did not know it. He put the ring in his pocket almost without thinking;
> certainly it did not seem of any particular use at the moment." -
> Riddles in the Dark - The Hobbit
> The other bits are actually used in one condition: to mark the SV as
> freed SvTYPE is set to 0xFF. Other than that, the bits are indeed
> unused. They're probably the most precious bits we have in perl, given
> that everyone wants flag bits for their favorite feature.
> Leon

Just to get this documented, we could expand the number of SV types to 
take an enum of 5 bits, with one of the 16 new types being reserved for 
freed.  That would take care of the all uses, leaving an extra 15 types, 
and 3 flag bits.

I'm trying to remember all the proposals that have stalled for lack of 
available bits

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About