aboutsummaryrefslogtreecommitdiff
path: root/src/library.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/library.js')
-rw-r--r--src/library.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/library.js b/src/library.js
index ad1ff696..47e15aae 100644
--- a/src/library.js
+++ b/src/library.js
@@ -4687,6 +4687,34 @@ LibraryManager.library = {
},
nanf: 'nan',
+ sincos: function(x, sine, cosine) {
+ var sineVal = Math.sin(x),
+ cosineVal = Math.cos(x);
+ {{{ makeSetValue('sine', '0', 'sineVal', 'double') }}};
+ {{{ makeSetValue('cosine', '0', 'cosineVal', 'double') }}};
+ },
+
+ sincosf: function(x, sine, cosine) {
+ var sineVal = Math.sin(x),
+ cosineVal = Math.cos(x);
+ {{{ makeSetValue('sine', '0', 'sineVal', 'float') }}};
+ {{{ makeSetValue('cosine', '0', 'cosineVal', 'float') }}};
+ },
+
+ __div_t_struct_layout: Runtime.generateStructInfo([
+ ['i32', 'quot'],
+ ['i32', 'rem'],
+ ]),
+ div__deps: ['__div_t_struct_layout'],
+ div: function(divt, numer, denom) {
+ var quot = Math.floor(numer / denom);
+ var rem = numer - quot * denom;
+ var offset = ___div_t_struct_layout.rem;
+ {{{ makeSetValue('divt', '0', 'quot', 'i32') }}};
+ {{{ makeSetValue('divt', 'offset', 'rem', 'i32') }}};
+ return divt;
+ },
+
__fpclassifyf: function(x) {
if (isNaN(x)) return {{{ cDefine('FP_NAN') }}};
if (!isFinite(x)) return {{{ cDefine('FP_INFINITE') }}};
@@ -5720,6 +5748,20 @@ LibraryManager.library = {
},
// ==========================================================================
+ // arpa/inet.h
+ // ==========================================================================
+
+ htonl: function(value) {
+ return ((value & 0xff) << 24) + ((value & 0xff00) << 8) +
+ ((value & 0xff0000) >> 8) + ((value & 0xff000000) >> 24);
+ },
+ htons: function(value) {
+ return ((value & 0xff) << 8) + ((value & 0xff00) >> 8);
+ },
+ ntohl: 'htonl',
+ ntohs: 'htons',
+
+ // ==========================================================================
// emscripten.h
// ==========================================================================