Digest-FNV

 view release on metacpan or  search on metacpan

FNV.xs  view on Meta::CPAN

CODE:
    RETVAL = fnv32a(SvPV_nolen(a));
OUTPUT:
    RETVAL

Fnv64_t *
fnv64_t(a)
    SV *  a
INIT:
    Fnv64_t *   tfnv;
PPCODE:
    tfnv = fnv64_t(SvPV_nolen(a));
    if (tfnv==0UL) {
        XPUSHs(sv_2mortal(newSVnv(-1)));
    }
    else {
        XPUSHs(sv_2mortal(newSVnv(tfnv->lower)));
        XPUSHs(sv_2mortal(newSVnv(tfnv->upper)));
    }

Fnv64_t *
fnv64a_t(a)
    SV *  a
INIT:
    Fnv64_t *   tfnv;
PPCODE:
    tfnv = fnv64a_t(SvPV_nolen(a));
    if (tfnv==0UL) {
        XPUSHs(sv_2mortal(newSVnv(-1)));
    }
    else {
        XPUSHs(sv_2mortal(newSVnv(tfnv->lower)));
        XPUSHs(sv_2mortal(newSVnv(tfnv->upper)));
    }

const-xs.inc  view on Meta::CPAN

	dTARGET;
#endif
	STRLEN		len;
        int		type;
	IV		iv;
	/* NV		nv;	Uncomment this if you need to return NVs */
	/* const char	*pv;	Uncomment this if you need to return PVs */
    INPUT:
	SV *		sv;
        const char *	s = SvPV(sv, len);
    PPCODE:
        /* Change this to constant(aTHX_ s, len, &iv, &nv);
           if you need to return both NVs and IVs */
	type = constant(aTHX_ s, len, &iv);
      /* Return 1 or 2 items. First is error message, or undef if no error.
           Second, if present, is found value */
        switch (type) {
        case PERL_constant_NOTFOUND:
          sv =
	    sv_2mortal(newSVpvf("%s is not a valid Digest::FNV macro", s));
          PUSHs(sv);

fallback/const-xs.inc  view on Meta::CPAN

	dTARGET;
#endif
	STRLEN		len;
        int		type;
	IV		iv;
	/* NV		nv;	Uncomment this if you need to return NVs */
	/* const char	*pv;	Uncomment this if you need to return PVs */
    INPUT:
	SV *		sv;
        const char *	s = SvPV(sv, len);
    PPCODE:
        /* Change this to constant(aTHX_ s, len, &iv, &nv);
           if you need to return both NVs and IVs */
	type = constant(aTHX_ s, len, &iv);
      /* Return 1 or 2 items. First is error message, or undef if no error.
           Second, if present, is found value */
        switch (type) {
        case PERL_constant_NOTFOUND:
          sv =
	    sv_2mortal(newSVpvf("%s is not a valid Digest::FNV macro", s));
          PUSHs(sv);



( run in 0.681 second using v1.01-cache-2.11-cpan-5511b514fd6 )