Skip to content
This repository
Browse code

data-type support from Vasili Sviridov's patches

  • Loading branch information...
commit 45c1dbe65186f58f470eca0cba7c4090783d2824 1 parent 4dfea19
Theo Schlossnagle authored June 01, 2011
155  amqp.js
@@ -2,6 +2,7 @@ var events = require('events'),
2 2
     sys = require('sys'),
3 3
     net = require('net'),
4 4
     protocol,
  5
+    jspack = require('./jspack').jspack,
5 6
     Buffer = require('buffer').Buffer,
6 7
     Promise = require('./promise').Promise;
7 8
 
@@ -271,7 +272,7 @@ function parseInt (buffer, size) {
271 272
 
272 273
 function parseShortString (buffer) {
273 274
   var length = buffer[buffer.read++];
274  
-  var s = buffer.toString('utf-8', buffer.read, buffer.read+length);
  275
+  var s = buffer.toString('utf8', buffer.read, buffer.read+length);
275 276
   buffer.read += length;
276 277
   return s;
277 278
 }
@@ -310,18 +311,31 @@ function parseTable (buffer) {
310 311
         break;
311 312
 
312 313
       case 'D'.charCodeAt(0):
313  
-        var decimals = buffer[buffer.read++];
314  
-        var int = parseInt(buffer, 4);
315  
-        // TODO make into float...?
316  
-        // FIXME this isn't correct
317  
-        table[field] = '?';
  314
+        var dec = parseInt(buffer, 1);
  315
+        var num = parseInt(buffer, 4);
  316
+        table[field] = num / (dec * 10);
318 317
         break;
319 318
 
  319
+      case 'd'.charCodeAt(0):
  320
+        var b = [];
  321
+        for (var i = 0; i < 8; ++i)
  322
+          b[i] = buffer[buffer.read++];
  323
+
  324
+          table[field] = (new jspack(true)).Unpack('d', b);
  325
+          break;
  326
+
  327
+      case 'f'.charCodeAt(0):
  328
+        var b = [];
  329
+        for (var i = 0; i < 4; ++i)
  330
+          b[i] = buffer[buffer.read++];
  331
+
  332
+          table[field] = (new jspack(true)).Unpack('f', b);
  333
+          break;
  334
+
320 335
       case 'T'.charCodeAt(0):
321  
-        // 64bit time stamps. Awesome.
322 336
         var int = parseInt(buffer, 8);
323  
-        // TODO FIXME this isn't correct
324  
-        table[field] = '?';
  337
+        table[field] = new Date();
  338
+        table[field].setTime(int * 1000);
325 339
         break;
326 340
 
327 341
       case 'F'.charCodeAt(0):
@@ -331,11 +345,16 @@ function parseTable (buffer) {
331 345
       case 'l'.charCodeAt(0):
332 346
         table[field] = parseInt(buffer, 8);
333 347
         break;
334  
-      
  348
+
335 349
       case 't'.charCodeAt(0):
336 350
         table[field] = (parseInt(buffer, 1) > 0);
337 351
         break;
338 352
 
  353
+      case 'a'.charCodeAt(0):
  354
+        var len = parseInt(buffer, 4);
  355
+        table[field] = buffer.splice(buffer.read, buffer.read + len);
  356
+        break;
  357
+
339 358
       default:
340 359
         throw new Error("Unknown field value type " + buffer[buffer.read-1]);
341 360
     }
@@ -466,9 +485,27 @@ AMQPParser.prototype._parseHeaderFrame = function (channel, buffer) {
466 485
   }
467 486
 };
468 487
 
  488
+function serializeFloat(b, size, value, bigEndian) {
  489
+  var jp = new jspack(bigEndian);
  490
+
  491
+  switch(size) {
  492
+  case 4:
  493
+    var x = jp.pack('f', [value]);
  494
+    for (var i = 0; i < x.length; ++i)
  495
+      b[b.used++] = x[i];
  496
+    break;
  497
+  
  498
+  case 8:
  499
+    var x = jp.pack('d', [value]);
  500
+    for (var i = 0; i < x.length; ++i)
  501
+      b[b.used++] = x[i];
  502
+    break;
  503
+
  504
+  default:
  505
+    throw new Error("Unknown floating point size");
  506
+  }
  507
+}
469 508
 
470  
-// Network byte order serialization
471  
-// (NOTE: javascript always uses network byte order for its ints.)
472 509
 function serializeInt (b, size, int) {
473 510
   if (b.used + size > b.length) {
474 511
     throw new Error("write out of bounds");
@@ -538,7 +575,7 @@ function serializeLongString (b, string) {
538 575
   if (typeof(string) == 'string') {
539 576
     var byteLength = Buffer.byteLength(string, 'utf8');
540 577
     serializeInt(b, 4, byteLength);
541  
-    b.write(string, b.used, 'utf-8');
  578
+    b.write(string, b.used, 'utf8');
542 579
     b.used += byteLength;
543 580
   } else if (typeof(string) == 'object') {
544 581
     serializeTable(b, string);
@@ -551,14 +588,48 @@ function serializeLongString (b, string) {
551 588
   }
552 589
 }
553 590
 
  591
+function serializeDate(b, date) {
  592
+  serializeInt(b, 8, date.valueOf() / 1000);
  593
+}
  594
+
  595
+function serializeBuffer(b, buffer) {
  596
+  serializeInt(b, 4, buffer.length);
  597
+
  598
+  for (var i = 0; i < buffer.length; ++i) {
  599
+    b[b.used++] = buffer[i];
  600
+  }
  601
+}
  602
+
  603
+function serializeBase64(b, buffer) {
  604
+  serializeLongString(b, buffer.toString('base64'));
  605
+}
  606
+
  607
+function isBigInt(value) {
  608
+  return value > 0xffffffff;
  609
+}
  610
+
  611
+function getCode(dec) { 
  612
+  var hexArray = "0123456789ABCDEF".split('');
  613
+  
  614
+  var code1 = Math.floor(dec / 16);
  615
+  var code2 = dec - code1 * 16;
  616
+  return hexArray[code2];
  617
+}
  618
+
  619
+function isFloat(value)
  620
+{
  621
+  return value === +value && value !== (value|0);
  622
+}
554 623
 
555 624
 function serializeTable (b, object) {
556 625
   if (typeof(object) != "object") {
557 626
     throw new Error("param must be an object");
558 627
   }
559 628
 
  629
+  // Save our position so that we can go back and write the length of this table
  630
+  // at the beginning of the packet (once we know how many entries there are).
560 631
   var lengthIndex = b.used;
561  
-  b.used += 4; // for the long
  632
+  b.used += 4; // sizeof long
562 633
 
563 634
   var startIndex = b.used;
564 635
 
@@ -576,22 +647,43 @@ function serializeTable (b, object) {
576 647
         break;
577 648
 
578 649
       case 'number':
579  
-        if (value <= 0xFFFFFFFF) {
580  
-          b[b.used++] = 'I'.charCodeAt(0);
581  
-          serializeInt(b, 4, value);
582  
-        } else if (value > 0xFFFFFFFF) {
583  
-          b[b.used++] = 'T'.charCodeAt(0);
584  
-          serializeInt(b, 8, value);
585  
-        } 
586  
-        // TODO decimal? meh.
  650
+        if (!isFloat(value)) {
  651
+          if (isBigInt(value)) {
  652
+            // 64-bit uint
  653
+            b[b.used++] = 'l'.charCodeAt(0);
  654
+            serializeInt(b, 8, value);
  655
+          } else {
  656
+            //32-bit uint
  657
+            b[b.used++] = 'I'.charCodeAt(0);
  658
+            serializeInt(b, 4, value);
  659
+          }
  660
+        } else {
  661
+          //64-bit float
  662
+          b[b.used++] = 'd'.charCodeAt(0);
  663
+          serializeFloat(b, 8, value);
  664
+        }
587 665
         break;
588 666
 
589  
-      case 'object':
590  
-        serializeTable(b, value);
  667
+      case 'boolean':
  668
+        b[b.used++] = 't'.charCodeAt(0);
  669
+        b[b.used++] = value;
591 670
         break;
592 671
 
593 672
       default:
594  
-        throw new Error("unsupported type in amqp table");
  673
+      if(value instanceof Date) {
  674
+        b[b.used++] = 'T'.charCodeAt(0);
  675
+        serializeDate(b.value);
  676
+      } else if (value instanceof Buffer) {
  677
+        b[b.used++] = 'a'.charCodeAt(0);
  678
+        serializeBuffer(b, value);
  679
+      } else {
  680
+        if(typeof(value) === 'object') {
  681
+          b[b.used++] = 'F'.charCodeAt(0);
  682
+          serializeTable(b, value);
  683
+        } else {
  684
+          this.throwError("unsupported type in amqp table: " + typeof(value));
  685
+        }
  686
+      }
595 687
     }
596 688
   }
597 689
 
@@ -1359,8 +1451,17 @@ Queue.prototype.subscribe = function (/* options, messageListener */) {
1359 1451
       json._routingKey = m.routingKey;
1360 1452
       json._deliveryTag = m.deliveryTag;
1361 1453
 
1362  
-      if(messageListener) messageListener(json);
1363  
-      self.emit('message', json, this.headers);
  1454
+      var headers = {};
  1455
+      for (var i in this.headers) {
  1456
+        if(this.headers.hasOwnProperty(i)) {
  1457
+          if(this.headers[i] instanceof Buffer)
  1458
+            headers[i] = this.headers[i].toString();
  1459
+          else
  1460
+            headers[i] = this.headers[i];
  1461
+        }
  1462
+      }
  1463
+      if (messageListener) messageListener(json, headers);
  1464
+      self.emit('message', json, headers);
1364 1465
     });
1365 1466
   });
1366 1467
 };
481  jspack.js
... ...
@@ -0,0 +1,481 @@
  1
+// Copyright (c) 2008, Fair Oaks Labs, Inc.
  2
+// All rights reserved.
  3
+// 
  4
+// Redistribution and use in source and binary forms, with or without modification, are
  5
+// permitted provided that the following conditions are met:
  6
+// 
  7
+//     * Redistributions of source code must retain the above copyright notice, this list
  8
+//       of conditions and the following disclaimer.
  9
+//     * Redistributions in binary form must reproduce the above copyright notice, this
  10
+//       list of conditions and the following disclaimer in the documentation and/or other
  11
+//       materials provided with the distribution.
  12
+//     * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors may be
  13
+//       used to endorse or promote products derived from this software without specific
  14
+//       prior written permission.
  15
+// 
  16
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  17
+// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  18
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
  19
+// THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  20
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  21
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  22
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  23
+// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  24
+// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25
+// Modified from original JSPack <cbond@positrace.com>
  26
+exports.jspack = function (bigEndian) {
  27
+  this.bigEndian = bigEndian;
  28
+}
  29
+
  30
+exports.jspack.prototype._DeArray = function (a, p, l) {
  31
+  return [a.slice(p, p + l)];
  32
+};
  33
+
  34
+exports.jspack.prototype._EnArray = function (a, p, l, v) {
  35
+  for (var i = 0; i < l; ++i) {
  36
+    a[p + i] = v[i] ? v[i] : 0;
  37
+  }
  38
+};
  39
+
  40
+exports.jspack.prototype._DeChar = function (a, p) {
  41
+  return String.fromCharCode(a[p]);
  42
+};
  43
+
  44
+exports.jspack.prototype._EnChar = function (a, p, v) {
  45
+  a[p] = v.charCodeAt(0);
  46
+};
  47
+
  48
+exports.jspack.prototype._DeInt = function (a, p) {
  49
+  var lsb = bigEndian ? format.len - 1 : 0;
  50
+  var nsb = bigEndian ? -1 : 1;
  51
+  var stp = lsb + nsb * format.len,
  52
+      rv;
  53
+  var ret = 0;
  54
+
  55
+  var i = lsb;
  56
+  var f = 1;
  57
+  while (i != stp) {
  58
+    rv += a[p + i] * f;
  59
+    i += nsb;
  60
+    f *= 256;
  61
+  }
  62
+
  63
+  if (format.signed) {
  64
+    if ((rv & Math.pow(2, format.len * 8 - 1)) != 0) {
  65
+      rv -= Math.pow(2, format.len * 8);
  66
+    }
  67
+  }
  68
+
  69
+  return rv;
  70
+};
  71
+
  72
+exports.jspack.prototype._EnInt = function (a, p, v) {
  73
+  var lsb = bigEndian ? format.len - 1 : 0;
  74
+  var nsb = bigEndian ? -1 : 1;
  75
+  var stp = lsb + nsb * format.len;
  76
+
  77
+  v = v < format.min ? format.min : ((v > format.max) ? format.max : v);
  78
+
  79
+  var i = lsb;
  80
+  while (i != stp) {
  81
+    a[p + i] = v & 0xff;
  82
+    i += nsb;
  83
+    v >>= 8;
  84
+  }
  85
+};
  86
+
  87
+exports.jspack.prototype._DeString = function (a, p, l) {
  88
+  var rv = new Array(1);
  89
+
  90
+  for (i = 0; i < l; i++) {
  91
+    rv[i] = String.fromCharCode(a[p + i]);
  92
+  }
  93
+
  94
+  return rv.join('');
  95
+};
  96
+
  97
+exports.jspack.prototype._EnString = function (a, p, l, v) {
  98
+  for (var t, i = 0; i < l; ++i) {
  99
+    t = v.charCodeAt(i);
  100
+    if (!t) t = 0;
  101
+
  102
+    a[p + i] = t;
  103
+  }
  104
+};
  105
+
  106
+exports.jspack.prototype._De754 = function (a, p) {
  107
+  var s, e, m, i, d, bits, bit, len, bias, max;
  108
+
  109
+  bit = format.bit;
  110
+  len = format.len * 8 - format.bit - 1;
  111
+  max = (1 << len) - 1;
  112
+  bias = max >> 1;
  113
+
  114
+  i = bigEndian ? 0 : format.len - 1;
  115
+  d = bigEndian ? 1 : -1;;
  116
+  s = a[p + i];
  117
+  i = i + d;
  118
+
  119
+  bits = -7;
  120
+
  121
+  e = s & ((1 << -bits) - 1);
  122
+  s >>= -bits;
  123
+
  124
+  for (bits += len; bits > 0; bits -= 8) {
  125
+    e = e * 256 + a[p + i];
  126
+    i += d;
  127
+  }
  128
+
  129
+  m = e & ((1 << -bits) - 1);
  130
+  e >>= -bits;
  131
+
  132
+  for (bits += bit; bits > 0; bits -= 8) {
  133
+    m = m * 256 + a[p + i];
  134
+    i += d;
  135
+  }
  136
+
  137
+  switch (e) {
  138
+  case 0:
  139
+    // Zero, or denormalized number
  140
+    e = 1 - bias;
  141
+    break;
  142
+
  143
+  case max:
  144
+    // NaN, or +/-Infinity
  145
+    return m ? NaN : ((s ? -1 : 1) * Infinity);
  146
+
  147
+  default:
  148
+    // Normalized number
  149
+    m = m + Math.pow(2, bit);
  150
+    e = e - bias;
  151
+    break;
  152
+  }
  153
+
  154
+  return (s ? -1 : 1) * m * Math.pow(2, e - bit);
  155
+};
  156
+
  157
+exports.jspack.prototype._En754 = function (a, p, v) {
  158
+  var s, e, m, i, d, c, bit, len, bias, max;
  159
+
  160
+  bit = format.bit;
  161
+  len = format.len * 8 - format.bit - 1;
  162
+  max = (1 << len) - 1;
  163
+  bias = max >> 1;
  164
+
  165
+  s = v < 0 ? 1 : 0;
  166
+  v = Math.abs(v);
  167
+
  168
+  if (isNaN(v) || (v == Infinity)) {
  169
+    m = isNaN(v) ? 1 : 0;
  170
+    e = max;
  171
+  } else {
  172
+    e = Math.floor(Math.log(v) / Math.LN2); // Calculate log2 of the value
  173
+    c = Math.pow(2, -e);
  174
+    if (v * c < 1) {
  175
+      e--;
  176
+      c = c * 2;
  177
+    }
  178
+
  179
+    // Round by adding 1/2 the significand's LSD
  180
+    if (e + bias >= 1) {
  181
+      v += format.rt / c; // Normalized: bit significand digits
  182
+    } else {
  183
+      v += format.rt * Math.pow(2, 1 - bias); // Denormalized:  <= bit significand digits
  184
+    }
  185
+    if (v * c >= 2) {
  186
+      e++;
  187
+      c = c / 2; // Rounding can increment the exponent
  188
+    }
  189
+
  190
+    if (e + bias >= max) { // overflow
  191
+      m = 0;
  192
+      e = max;
  193
+    } else if (e + bias >= 1) { // normalized
  194
+      m = (v * c - 1) * Math.pow(2, bit); // do not reorder this expression
  195
+      e = e + bias;
  196
+    } else {
  197
+      // Denormalized - also catches the '0' case, somewhat by chance
  198
+      m = v * Math.pow(2, bias - 1) * Math.pow(2, bit);
  199
+      e = 0;
  200
+    }
  201
+  }
  202
+
  203
+  i = bigEndian ? format.len - 1 : 0;
  204
+  d = bigEndian ? -1 : 1;;
  205
+
  206
+  while (bit >= 8) {
  207
+    a[p + i] = m & 0xff;
  208
+    i += d;
  209
+    m /= 256;
  210
+    bit -= 8;
  211
+  }
  212
+
  213
+  e = (e << bit) | m;
  214
+  for (len += bit; len > 0; len -= 8) {
  215
+    a[p + i] = e & 0xff;
  216
+    i += d;
  217
+    e /= 256;
  218
+  }
  219
+
  220
+  a[p + i - d] |= s * 128;
  221
+};
  222
+
  223
+// Unpack a series of n formatements of size s from array a at offset p with fxn
  224
+exports.jspack.prototype._UnpackSeries = function (n, s, a, p) {
  225
+  var fxn = format.de;
  226
+
  227
+  var ret = [];
  228
+  for (var i = 0; i < n; i++) {
  229
+    ret.push(fxn(a, p + i * s));
  230
+  }
  231
+
  232
+  return ret;
  233
+};
  234
+
  235
+// Pack a series of n formatements of size s from array v at offset i to array a at offset p with fxn
  236
+exports.jspack.prototype._PackSeries = function (n, s, a, p, v, i) {
  237
+  var fxn = format.en;
  238
+
  239
+  for (o = 0; o < n; o++) {
  240
+    fxn(a, p + o * s, v[i + o]);
  241
+  }
  242
+};
  243
+
  244
+// Unpack the octet array a, beginning at offset p, according to the fmt string
  245
+exports.jspack.prototype.Unpack = function (fmt, a, p) {
  246
+  bigEndian = fmt.charAt(0) != '<';
  247
+
  248
+  if (p == undefined || p == null) p = 0;
  249
+
  250
+  var re = new RegExp(this._sPattern, 'g');
  251
+
  252
+  var ret = [];
  253
+
  254
+  for (var m; m = re.exec(fmt); /* */ ) {
  255
+    var n;
  256
+    if (m[1] == undefined || m[1] == '') n = 1;
  257
+    else n = parseInt(m[1]);
  258
+
  259
+    var s = this._lenLut[m[2]];
  260
+
  261
+    if ((p + n * s) > a.length) return undefined;
  262
+
  263
+    switch (m[2]) {
  264
+    case 'A':
  265
+    case 's':
  266
+      rv.push(this._formatLut[m[2]].de(a, p, n));
  267
+      break;
  268
+    case 'c':
  269
+    case 'b':
  270
+    case 'B':
  271
+    case 'h':
  272
+    case 'H':
  273
+    case 'i':
  274
+    case 'I':
  275
+    case 'l':
  276
+    case 'L':
  277
+    case 'f':
  278
+    case 'd':
  279
+      format = this._formatLut[m[2]];
  280
+      ret.push(this._UnpackSeries(n, s, a, p));
  281
+      break;
  282
+    }
  283
+
  284
+    p += n * s;
  285
+  }
  286
+
  287
+  return Array.prototype.concat.apply([], ret);
  288
+};
  289
+
  290
+// Pack the supplied values into the octet array a, beginning at offset p, according to the fmt string
  291
+exports.jspack.prototype.PackTo = function (fmt, a, p, values) {
  292
+  bigEndian = (fmt.charAt(0) != '<');
  293
+
  294
+  var re = new RegExp(this._sPattern, 'g');
  295
+
  296
+  for (var m, i = 0; m = re.exec(fmt); /* */ ) {
  297
+    var n;
  298
+    if (m[1] == undefined || m[1] == '') n = 1;
  299
+    else n = parseInt(m[1]);
  300
+
  301
+    var s = this._lenLut[m[2]];
  302
+
  303
+    if ((p + n * s) > a.length) return false;
  304
+
  305
+    switch (m[2]) {
  306
+    case 'A':
  307
+    case 's':
  308
+      if ((i + 1) > values.length) return false;
  309
+
  310
+      this._formatLut[m[2]].en(a, p, n, values[i]);
  311
+
  312
+      i += 1;
  313
+      break;
  314
+
  315
+    case 'c':
  316
+    case 'b':
  317
+    case 'B':
  318
+    case 'h':
  319
+    case 'H':
  320
+    case 'i':
  321
+    case 'I':
  322
+    case 'l':
  323
+    case 'L':
  324
+    case 'f':
  325
+    case 'd':
  326
+      format = this._formatLut[m[2]];
  327
+
  328
+      if (i + n > values.length) return false;
  329
+
  330
+      this._PackSeries(n, s, a, p, values, i);
  331
+
  332
+      i += n;
  333
+      break;
  334
+
  335
+    case 'x':
  336
+      for (var j = 0; j < n; j++) {
  337
+        a[p + j] = 0;
  338
+      }
  339
+      break;
  340
+    }
  341
+
  342
+    p += n * s;
  343
+  }
  344
+
  345
+  return a;
  346
+};
  347
+
  348
+// Pack the supplied values into a new octet array, according to the fmt string
  349
+exports.jspack.prototype.Pack = function (fmt, values) {
  350
+  return this.PackTo(fmt, new Array(this.CalcLength(fmt)), 0, values);
  351
+};
  352
+
  353
+// Determine the number of bytes represented by the format string
  354
+exports.jspack.prototype.CalcLength = function (fmt) {
  355
+  var re = new RegExp(this._sPattern, 'g');
  356
+  var sz = 0;
  357
+
  358
+  while (match = re.exec(fmt)) {
  359
+    var n;
  360
+    if (match[1] == undefined || match[1] == '') n = 1;
  361
+    else n = parseInt(match[1]);
  362
+
  363
+    sz += n * this._lenLut[match[2]];
  364
+  }
  365
+
  366
+  return sz;
  367
+};
  368
+
  369
+// Regular expression for counting digits
  370
+exports.jspack.prototype._sPattern = '(\\d+)?([AxcbBhHsfdiIlL])';
  371
+
  372
+// Byte widths for associated formats
  373
+exports.jspack.prototype._lenLut = {
  374
+  'A': 1,
  375
+  'x': 1,
  376
+  'c': 1,
  377
+  'b': 1,
  378
+  'B': 1,
  379
+  'h': 2,
  380
+  'H': 2,
  381
+  's': 1,
  382
+  'f': 4,
  383
+  'd': 8,
  384
+  'i': 4,
  385
+  'I': 4,
  386
+  'l': 4,
  387
+  'L': 4
  388
+};
  389
+
  390
+exports.jspack.prototype._formatLut = {
  391
+  'A': {
  392
+    en: exports.jspack.prototype._EnArray,
  393
+    de: exports.jspack.prototype._DeArray
  394
+  },
  395
+  's': {
  396
+    en: exports.jspack.prototype._EnString,
  397
+    de: exports.jspack.prototype._DeString
  398
+  },
  399
+  'c': {
  400
+    en: exports.jspack.prototype._EnChar,
  401
+    de: exports.jspack.prototype._DeChar
  402
+  },
  403
+  'b': {
  404
+    en: exports.jspack.prototype._EnInt,
  405
+    de: exports.jspack.prototype._DeInt,
  406
+    len: 1,
  407
+    signed: true,
  408
+    min: -Math.pow(2, 7),
  409
+    max: Math.pow(2, 7) - 1
  410
+  },
  411
+  'B': {
  412
+    en: exports.jspack.prototype._EnInt,
  413
+    de: exports.jspack.prototype._DeInt,
  414
+    len: 1,
  415
+    signed: false,
  416
+    min: 0,
  417
+    max: Math.pow(2, 8) - 1
  418
+  },
  419
+  'h': {
  420
+    en: exports.jspack.prototype._EnInt,
  421
+    de: exports.jspack.prototype._DeInt,
  422
+    len: 2,
  423
+    signed: true,
  424
+    min: -Math.pow(2, 15),
  425
+    max: Math.pow(2, 15) - 1
  426
+  },
  427
+  'H': {
  428
+    en: exports.jspack.prototype._EnInt,
  429
+    de: exports.jspack.prototype._DeInt,
  430
+    len: 2,
  431
+    signed: false,
  432
+    min: 0,
  433
+    max: Math.pow(2, 16) - 1
  434
+  },
  435
+  'i': {
  436
+    en: exports.jspack.prototype._EnInt,
  437
+    de: exports.jspack.prototype._DeInt,
  438
+    len: 4,
  439
+    signed: true,
  440
+    min: -Math.pow(2, 31),
  441
+    max: Math.pow(2, 31) - 1
  442
+  },
  443
+  'I': {
  444
+    en: exports.jspack.prototype._EnInt,
  445
+    de: exports.jspack.prototype._DeInt,
  446
+    len: 4,
  447
+    signed: false,
  448
+    min: 0,
  449
+    max: Math.pow(2, 32) - 1
  450
+  },
  451
+  'l': {
  452
+    en: exports.jspack.prototype._EnInt,
  453
+    de: exports.jspack.prototype._DeInt,
  454
+    len: 4,
  455
+    signed: true,
  456
+    min: -Math.pow(2, 31),
  457
+    max: Math.pow(2, 31) - 1
  458
+  },
  459
+  'L': {
  460
+    en: exports.jspack.prototype._EnInt,
  461
+    de: exports.jspack.prototype._DeInt,
  462
+    len: 4,
  463
+    signed: false,
  464
+    min: 0,
  465
+    max: Math.pow(2, 32) - 1
  466
+  },
  467
+  'f': {
  468
+    en: exports.jspack.prototype._En754,
  469
+    de: exports.jspack.prototype._De754,
  470
+    len: 4,
  471
+    bit: 23,
  472
+    rt: Math.pow(2, -24) - Math.pow(2, -77)
  473
+  },
  474
+  'd': {
  475
+    en: exports.jspack.prototype._En754,
  476
+    de: exports.jspack.prototype._De754,
  477
+    len: 8,
  478
+    bit: 52,
  479
+    rt: 0
  480
+  }
  481
+};
1  package.json
@@ -13,6 +13,7 @@
13 13
   , { "name" : "Stéphane Alnet" }
14 14
   , { "name" : "Alen Mujezinovic" }
15 15
   , { "name" : "Michael Bridgen" }
  16
+  , { "name" : "Chris Bond" }
16 17
   ]
17 18
 , "repository" :
18 19
   { "type" : "git"

0 notes on commit 45c1dbe

Please sign in to comment.
Something went wrong with that request. Please try again.