diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-01-28 21:29:02 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-01-28 21:29:02 -0800 |
commit | 687b8cfa3d105a634b3c9cfbc5fc287f1517fae3 (patch) | |
tree | eea2952d7673296ba6a8cd2384061fc3ad270473 /src/library.js | |
parent | c516fa7758636e15a7077c658db3c74533c7ee38 (diff) | |
parent | b6ebeed2cfcebb220f2ce700c7cbe484e62cd2e2 (diff) |
Merge branch 'master' into llvmopts
Diffstat (limited to 'src/library.js')
-rw-r--r-- | src/library.js | 42 |
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 // ========================================================================== |