From: Vincent Pit Date: Mon, 28 Dec 2009 22:56:45 +0000 (+0100) Subject: Cast the op_info value before applying bit shifts X-Git-Tag: v0.40~6 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=705dd25f6bac4f48abb98f534cc33e5f918b9faa;p=perl%2Fmodules%2FVariable-Magic.git Cast the op_info value before applying bit shifts Also move the opinfo member before the uvar one in the MGWIZ struct, as it's used more frequently. --- diff --git a/Magic.xs b/Magic.xs index f64d001..9da0b25 100644 --- a/Magic.xs +++ b/Magic.xs @@ -331,8 +331,8 @@ STATIC const char vmg_argstorefailed[] = "Error while storing arguments"; typedef struct { MGVTBL *vtbl; - U8 uvar; U8 opinfo; + U8 uvar; SV *cb_data; SV *cb_get, *cb_set, *cb_len, *cb_clear, *cb_free; @@ -949,12 +949,15 @@ STATIC int vmg_cb_call(pTHX_ SV *cb, unsigned int flags, SV *sv, ...) { return ret; } -#define vmg_cb_call1(I, F, S, A1) \ - vmg_cb_call(aTHX_ (I), (((F) << VMG_CB_CALL_ARGS_SHIFT) | 1), (S), (A1)) -#define vmg_cb_call2(I, F, S, A1, A2) \ - vmg_cb_call(aTHX_ (I), (((F) << VMG_CB_CALL_ARGS_SHIFT) | 2), (S), (A1), (A2)) -#define vmg_cb_call3(I, F, S, A1, A2, A3) \ - vmg_cb_call(aTHX_ (I), (((F) << VMG_CB_CALL_ARGS_SHIFT) | 3), (S), (A1), (A2), (A3)) +#define VMG_CB_FLAGS(OI, A) \ + ((((unsigned int) (OI)) << VMG_CB_CALL_ARGS_SHIFT) | (A)) + +#define vmg_cb_call1(I, OI, S, A1) \ + vmg_cb_call(aTHX_ (I), VMG_CB_FLAGS((OI), 1), (S), (A1)) +#define vmg_cb_call2(I, OI, S, A1, A2) \ + vmg_cb_call(aTHX_ (I), VMG_CB_FLAGS((OI), 2), (S), (A1), (A2)) +#define vmg_cb_call3(I, OI, S, A1, A2, A3) \ + vmg_cb_call(aTHX_ (I), VMG_CB_FLAGS((OI), 3), (S), (A1), (A2), (A3)) STATIC int vmg_svt_get(pTHX_ SV *sv, MAGIC *mg) { const MGWIZ *w = vmg_wizard_mgwiz(mg->mg_ptr);