diff options
author | Nicholas Clark <nick@ccl4.org> | 2000-12-13 20:08:50 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-12-14 23:40:58 +0000 |
commit | 16b7a9a47be196cb33bf757faad24e73ceffc2fc (patch) | |
tree | 674fd0d579f19451971d374d3735712349332279 /sv.h | |
parent | 1503adc40cad8d289062bdd60154f660cdeb7188 (diff) | |
download | perl-16b7a9a47be196cb33bf757faad24e73ceffc2fc.tar.gz |
faster and 64 bit preserving arithmetic
Message-ID: <20001213200849.B71166@plum.flirble.org>
p4raw-id: //depot/perl@8119
Diffstat (limited to 'sv.h')
-rw-r--r-- | sv.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -448,6 +448,9 @@ Tells and SV that it is an unsigned integer and disables all other OK bits. =for apidoc Am|void|SvIOK_UV|SV* sv Returns a boolean indicating whether the SV contains an unsigned integer. +=for apidoc Am|void|SvUOK|SV* sv +Returns a boolean indicating whether the SV contains an unsigned integer. + =for apidoc Am|void|SvIOK_notUV|SV* sv Returns a boolean indicating whether the SV contains an signed integer. @@ -562,6 +565,7 @@ Set the length of the string which is in the SV. See C<SvCUR>. #define SvIOK_UV(sv) ((SvFLAGS(sv) & (SVf_IOK|SVf_IVisUV)) \ == (SVf_IOK|SVf_IVisUV)) +#define SvUOK(sv) SvIOK_UV(sv) #define SvIOK_notUV(sv) ((SvFLAGS(sv) & (SVf_IOK|SVf_IVisUV)) \ == SVf_IOK) @@ -714,6 +718,12 @@ and disables all other OK bits. #define SvMAGIC(sv) ((XPVMG*) SvANY(sv))->xmg_magic #define SvSTASH(sv) ((XPVMG*) SvANY(sv))->xmg_stash +/* Ask a scalar nicely to try to become an IV, if possible. + Not guaranteed to stay returning void */ +/* Macro won't actually call sv_2iv if already IOK */ +#define SvIV_please(sv) \ + STMT_START {if (!SvIOKp(sv) && (SvNOK(sv) || SvPOK(sv))) \ + (void) SvIV(sv); } STMT_END #define SvIV_set(sv, val) \ STMT_START { assert(SvTYPE(sv) == SVt_IV || SvTYPE(sv) >= SVt_PVIV); \ (((XPVIV*) SvANY(sv))->xiv_iv = val); } STMT_END |