summaryrefslogtreecommitdiff
path: root/sv.h
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2000-12-15 19:17:06 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2000-12-15 19:17:06 +0000
commit28e5dec85047e189010079efa89eed07bc9eddc8 (patch)
treedd941df355c40cba395e514551ea847e8d07edfd /sv.h
parentc11ecd62a73b5b39df29fd460e1c4451c6e0e8af (diff)
downloadperl-28e5dec85047e189010079efa89eed07bc9eddc8.tar.gz
Return of the IVUV-preservation, now seems to be happy even
in Digital UNIX (the broken strtoul brokenness detection seems to have been the fly in the ointment). p4raw-id: //depot/perl@8138
Diffstat (limited to 'sv.h')
-rw-r--r--sv.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/sv.h b/sv.h
index 39c1c29323..53fc1f0ad5 100644
--- a/sv.h
+++ b/sv.h
@@ -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