GithubHelp home page GithubHelp logo

Comments (9)

Tux avatar Tux commented on July 16, 2024

Can you write that as a macro? As inline is not supported on all compilers, and I'd hate to make those slow just because gcc can do a better job

from text-csv_xs.

Tux avatar Tux commented on July 16, 2024

@pali do you have a test case that fails under the current code?

from text-csv_xs.

pali avatar pali commented on July 16, 2024

For test case you need to take scalar which do not have SVs_RMG, but has SVs_GMG. Then mg_get() would never be called.

from text-csv_xs.

pali avatar pali commented on July 16, 2024

Can you write that as a macro?

Yes, just rewrite commands via standard boolean logic into one if statement. E.g.:

#define _is_arrayref(sv) ((sv) && (SvGETMAGICAL(sv), 1) && (SvROK(sv)) && (SvTYPE(SvRV(sv)) == SVt_PVAV))

from text-csv_xs.

Tux avatar Tux commented on July 16, 2024
#define _is_reftype(f,x) \
    (f && (SvGETMAGIC (f), 1) && SvROK (f) && SvTYPE (SvRV (f)) == x)
#define _is_arrayref(f) _is_reftype (f, SVt_PVAV)
#define _is_hashref(f)  _is_reftype (f, SVt_PVHV)
#define _is_coderef(f)  _is_reftype (f, SVt_PVCV)

Still passed all tests. I could not come up with a new test in t/76_magic.t to probe the old code was wrong, but this looks cleaner anyway.
BTW it is SvGETMAGIC (sv) not SvGETMAGICAL (sv).
See 0fafcee

from text-csv_xs.

pali avatar pali commented on July 16, 2024

For example magic variable $$ has GMG and does not have RMG. But it is not reference. I do not know currently which internal perl variable is magic, reference and also without RMG.

from text-csv_xs.

Tux avatar Tux commented on July 16, 2024

Sure, but I still could not (yet) come up with a test :)

from text-csv_xs.

Tux avatar Tux commented on July 16, 2024

Change passed all tests on all 200+ perl versions I have that should be supported and all 858 modules on CPAN that directly or indirectly depend on my still pass. The speed test did not show a slowdown.
Just have to check on the other architectures, and it will be on its way to CPAN.
Thanks again for your input and feedback.

from text-csv_xs.

Tux avatar Tux commented on July 16, 2024

Released in 1.37. Closing

from text-csv_xs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.