view R/rdyncall/R/utils_float.R @ 61:c5a69c454963 default tip

- allow use of 'None' with 'Z' - bumped version to 1.4 (be in sync current dyncall version)
author Tassilo Philipp
date Mon, 03 Apr 2023 19:06:07 +0200
parents 0cfcc391201f
children
line wrap: on
line source

# Package: rdyncall
# File: R/utils_float.R
# Description: Support for C float vectors in R

as.floatraw <- function(x) 
{
  x <- .Call("r_as_floatraw", as.numeric(x), PACKAGE="rdyncall")
  class(x) <- "floatraw"
  x
}

floatraw2numeric <- function(x) 
{
  stopifnot(is.raw(x))
  stopifnot(class(x) == "floatraw")
  stopifnot(length(x) >= 4)
  .Call("r_floatraw2numeric", x, PACKAGE="rdyncall")
}

floatraw <- function(n)
{
  x <- raw(n*4)
  class(x) <- "floatraw"
  x
}