search for: as_raw

Displaying 5 results from an estimated 5 matches for "as_raw".

Did you mean: ao_raw
2005 Aug 20
1
Implementing a single-precision class with raw
...there don't seem to be any macros for handling raw vectors in Rdefines.h. I've made a guess at what those macros would be and was wondering whether my guesses were correct and/or might be included in 2.2.0: #define NEW_RAW(n) allocVector(RAWSXP,n) #define RAW_POINTER(x) (RAW(x)) #define AS_RAW(x) coerceVector(x,RAWSXP) I'm not sure whether coerceVector(x,RAWSXP) will actually work. Also, there isn't an Rf_isRaw() function, which would be useful for an IS_RAW(x) macro. Another issue with the "float" class is that it will run into endian issues if it ever gets saved...
2009 Jul 20
3
S_alloc or Calloc for return value
I am trying to write a C function to create a vector of integers that can be used by the R calling function. I do not know the size of the vector in the R calling function. (Well, actually, I have an upper limit on the size, but that is so large that R cannot allocate it. What I'm doing in the function is to do a sieving procedure, and the result will be small enough to fit into my
2012 Mar 17
1
how to pass 'raw' values with cfunction()?
I am having trouble handing "raw" data to a C function, using "cfunction", as demonstrated in the function and output pasted below. Can anyone suggest what I'm doing incorrectly? Thanks. Dan Kelley [Dalhousie University]. 1. TEST FILE library(inline) code <- 'Rprintf("inside f(), b is 0X%x\\n", *b);' f <-
2024 May 30
0
[RFC PATCH 7/8] rust: add firmware abstractions
...AFETY: Instances of `Device` are always ref-counted. > +unsafe impl crate::types::AlwaysRefCounted for Device { > + fn inc_ref(&self) { > + // SAFETY: The existence of a shared reference guarantees that the refcount is nonzero. > + unsafe { bindings::get_device(self.as_raw()) }; > + } > + > + unsafe fn dec_ref(obj: ptr::NonNull<Self>) { > + // SAFETY: The safety requirements guarantee that the refcount is nonzero. > + unsafe { bindings::put_device(obj.cast().as_ptr()) } > + } > +} > > The following comments giv...
2024 Jun 07
0
[RFC PATCH 7/8] rust: add firmware abstractions
...'a`. > + unsafe { &mut *ptr } Why not just + // SAFETY: Guaranteed by the safety requirements of the function. + unsafe { &*ptr.cast() } as in the original commit? > + } > + > + /// Returns the raw pointer to the device. > + pub(crate) fn as_raw(&self) -> *mut bindings::device { > + self.0.get() > + } > +} > diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs > index fbd91a48ff8b..dd1207f1a873 100644 > --- a/rust/kernel/lib.rs > +++ b/rust/kernel/lib.rs > @@ -28,6 +28,7 @@ > > pub mod allo...