search for: iterate_by_region_parti

Displaying 9 results from an estimated 9 matches for "iterate_by_region_parti".

2019 Oct 25
2
Unexpected behavior when using macro to loop over vector
...tomic vector. Here is a >> minimum >> example: >> >> C++ code >> ``` >> #include "R_ext/Itermacros.h" >> #define GET_REGION_BUFSIZE 2 >> //Redefine the macro since C++ is not happy with the implicit type >> conversion >> #define ITERATE_BY_REGION_PARTIAL(sx, px, idx, nb, etype, vtype, \ >> ? strt, nfull, expr) do { \ >> const etype *px = (etype*)DATAPTR_OR_NULL(sx); \ >> if (px != NULL) { \ >> ??? R_xlen_t __ibr_n__ = strt + nfull; \ >> ??? R_xlen_t nb = __ibr_n__; \ >> ??? for (R_xlen_t idx = strt; idx < __...
2019 Sep 23
2
What is the best way to loop over an ALTREP vector?
Sorry for post a lot of things, for the first part of code, I copied my C++ iter macro by mistake(and you can see an explicit type casting). Here is the macro definition from R_exts/Itermacros.h #define ITERATE_BY_REGION_PARTIAL(sx, px, idx, nb, etype, vtype, \ strt, nfull, expr) do { \ * const** etype *px = DATAPTR_OR_NULL(sx); * \ if (px != NULL) { \ R_xlen_t __ibr_n__ = strt + nfull;...
2019 Aug 28
3
What is the best way to loop over an ALTREP vector?
Hi devel team, I'm working on C/C++ level ALTREP compatibility for a package. The package previously used pointers to access the data of a SEXP, so it would not work for some ALTREP objects which do not have a pointer. I plan to rewrite the code and use functions like get_elt, get_region, and get_subset to access the values of a vector, so I have a few questions for ALTREP: 1. Since an
2019 Oct 23
2
Unexpected behavior when using macro to loop over vector
...I was trying to use the macro defined in "R_ext/Itermacros.h" to loop over an atomic vector. Here is a minimum example: C++ code ``` #include "R_ext/Itermacros.h" #define GET_REGION_BUFSIZE 2 //Redefine the macro since C++ is not happy with the implicit type conversion #define ITERATE_BY_REGION_PARTIAL(sx, px, idx, nb, etype, vtype, \ strt, nfull, expr) do { \ const etype *px = (etype*)DATAPTR_OR_NULL(sx); \ if (px != NULL) { \ R_xlen_t __ibr_n__ = strt + nfull; \ R_xlen_t nb = __ibr_n__; \ for (R_xlen_t idx = strt; idx < __ibr_n__; idx += nb) { \ expr \ } \ } \ else ITERATE_BY...
2019 Sep 24
2
What is the best way to loop over an ALTREP vector?
...szwjf08 at gmail.com> wrote: > > > > Sorry for post a lot of things, for the first part of code, I copied my > C++ > > iter macro by mistake(and you can see an explicit type casting). Here is > > the macro definition from R_exts/Itermacros.h > > > > #define ITERATE_BY_REGION_PARTIAL(sx, px, idx, nb, etype, vtype, \ > > > > strt, nfull, expr) do { \ > > > > * const** etype *px = DATAPTR_OR_NULL(sx); * > \ > > > > if (px != NULL) { \ > &...
2019 Sep 24
0
What is the best way to loop over an ALTREP vector?
...019, at 3:17 PM, Wang Jiefei <szwjf08 at gmail.com> wrote: > > Sorry for post a lot of things, for the first part of code, I copied my C++ > iter macro by mistake(and you can see an explicit type casting). Here is > the macro definition from R_exts/Itermacros.h > > #define ITERATE_BY_REGION_PARTIAL(sx, px, idx, nb, etype, vtype, \ > > strt, nfull, expr) do { \ > > * const** etype *px = DATAPTR_OR_NULL(sx); * \ > > if (px != NULL) { \ > > R_xlen...
2019 Oct 25
0
Unexpected behavior when using macro to loop over vector
Thank you, Tomas. I appreciate your help. BTW, could you also add an explicit type conversion in " ITERATE_BY_REGION_PARTIAL" macro while you are fixing the bug? C++ compiler does not happy with the implicit conversion from void* to T* somehow and I have to redefine it before using the macro. Best, Jiefei On Fri, Oct 25, 2019 at 11:13 AM Tomas Kalibera <tomas.kalibera at gmail.com> wrote: > On 10/25/19...
2019 Sep 23
0
What is the best way to loop over an ALTREP vector?
...found a small issue, it seems like the macro is written in C and does an implicit type conversion(const void * to const int *), see below. While it is allowed in C, C++ seems not happy with it. Is it possible to add an explicit type casting so that it can be compatible with both language? #define ITERATE_BY_REGION_PARTIAL(sx, px, idx, nb, etype, vtype, \ strt, nfull, expr) do { \ *const etype *px = (const** etype *)DATAPTR_OR_NULL(sx); * \ if (px != NULL) { \ R_xlen_t __ibr_n__ = strt + nfull;...
2019 Oct 25
0
Unexpected behavior when using macro to loop over vector
...ot;R_ext/Itermacros.h" to loop over an atomic vector. Here is a minimum > example: > > C++ code > ``` > #include "R_ext/Itermacros.h" > #define GET_REGION_BUFSIZE 2 > //Redefine the macro since C++ is not happy with the implicit type > conversion > #define ITERATE_BY_REGION_PARTIAL(sx, px, idx, nb, etype, vtype, \ > strt, nfull, expr) do { \ > const etype *px = (etype*)DATAPTR_OR_NULL(sx); \ > if (px != NULL) { \ > R_xlen_t __ibr_n__ = strt + nfull; \ > R_xlen_t nb = __ibr_n__; \ > for (R_xlen_t idx = strt; idx < __ibr_n__; idx += nb) { \...