[CCC DEV] REAL32 to FFI

Matt Jadud jadudm at gmail.com
Tue Jun 29 01:24:16 BST 2010


On Mon, Jun 28, 2010 at 6:22 PM, Adam Sampson <ats at offog.org> wrote:
> void _ffi_garble (word *w) {
>  float value = *((float *) w[1]);

Oddly, I can print INT32s using this function, but when I cast the
incoming data as a float, I get no love.

int ffi_sprintf (ECTX ectx, WORD args[]) {
  unsigned long int n = *((unsigned long int *) args[0]);

  printf("size [%d, %d] n [%f] [%f] [%ld] \n", sizeof(float),
sizeof(long int), (float)n, (double)n, (long int)n);

  return SFFI_OK;
}

As far as I can tell, no byte/word-swapping is necessary. Or, if you
prefer, I'm not swapping the INT32, and it comes through just fine.

It's times like this that I'm certain I'm missing something obvious.

Cheers,
Matt




More information about the developers mailing list