This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JS calling code | |
var obj = { | |
a: 5, | |
b : [1, 2, 3] | |
} | |
addon.add_array(obj); | |
assert(obj.b[0] == 6); | |
assert(obj.b[1] == 7); | |
assert(obj.b[2] == 8); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> /* Achim Flammenkamp, Bielefeld, D, achim@uni-bielefeld.de */ | |
#include <malloc.h>/* ifdefs: LONG=uns64 _ANSI_EXTENSION true_64bit_words */ | |
#include <stdlib.h>/* SUM_{p<x} 1/p= ln(ln(x))+0.5772156649015-0.315718451893 */ | |
#include <math.h> /* extern double sqrt(double), log(double), floor(double); */ | |
#ifndef uns32 /* Version 1.0a 1998-05-19 source availible */ | |
#define uns32 unsigned /* Version 2.0a 1998-05-23 5 years in the WWW */ | |
#endif /* Version 2.0b 2003-06-03 0-1-typo fixed Argh! */ | |
#ifndef uns64 /* Version 2.0c 2003-06-04 works up to 2^64-1 */ | |
# ifdef _ANSI_EXTENSION /* uses < 1938 MB for minimal sieve size to 2^64 */ | |
# define uns64 unsigned long long |