search for: reverseuint

Displaying 2 results from an estimated 2 matches for "reverseuint".

2009 Sep 20
1
Return a list from a .Call but segfaults
...urn(R_NilValue); } int num = INTEGER(numread)[0]; char *rawdata = (char*)RAW(raw); SEXP KV ,rval; int r; PROTECT(rval = Rf_allocVector(VECSXP, num)); for(int i=0;i<num;i++){ SEXP k = R_NilValue; PROTECT(KV = Rf_allocVector(VECSXP, 2)); r = reverseUInt(*((int*) rawdata)); //converts network order to host rawdata+=4; //yes, hard code size of int PROTECT(k= kk_(rawdata,r)); //deserializes data and returns a SEXP rawdata+= r; SET_VECTOR_ELT(KV,0, k); UNPROTECT(1); r = reverseUInt(*((int*) rawdata));...
2009 Sep 03
1
Running an expression 1MN times using embedded R
..._R_ReadConsole)(char *, unsigned char *, int, int); extern void (*ptr_R_WriteConsoleEx)(const char *, int , int ); SEXP rh_status(SEXP); static uint8_t SET_STATUS = 0x02; static R_CallMethodDef callMethods [] = { {"rh_status",(DL_FUNC)&rh_status,1}, {NULL, NULL, 0} }; uint32_t reverseUInt (uint32_t i) { uint8_t c1, c2, c3, c4; if (is_bigendian()) { return i; } else { c1 = i & 255; c2 = (i >> 8) & 255; c3 = (i >> 16) & 255; c4 = (i >> 24) & 255; return ((uint32_t)c1 << 24) +...