B2G/gecko/dom/mobilemessage/src/ril/WspPduHelper.jsm
/**
   * @param data
   *        A wrapped object to store encoded raw data.
   * @param numOrArray
   *        An octet array of less-equal than 30 elements or an integer
   *        greater-equal than 128.
   */
@param data
A wrapped object to store encoded raw data.
@param numOrArray
An octet array of less-equal than 30 elements or an integer
greater-equal than 128.
@param data A wrapped object to store encoded raw data . @param numOrArray An octet array of less - equal than 30 elements or an integer greater - equal than 128 .
function encode(data, numOrArray) {
    if (typeof numOrArray === "number") {
      let num = numOrArray;
      if (num >= 0x1000000000000) {
        throw new CodeError("Long-integer: number too large " + num);
      }
      let stack = [];
      do {
        stack.push(Math.floor(num % 256));
        num = Math.floor(num / 256);
      } while (num);
      Octet.encode(data, stack.length);
      while (stack.length) {
        Octet.encode(data, stack.pop());
      }
      return;
    }
    let array = numOrArray;
    if ((array.length < 1) || (array.length > 30)) {
      throw new CodeError("Long-integer: invalid length " + array.length);
    }
    Octet.encode(data, array.length);
    Octet.encodeMultiple(data, array);
  }
function encode ( data , numOrArray ) { if ( typeof numOrArray === "number" ) { let num = numOrArray ; if ( num >= 0x1000000000000 ) { throw new CodeError ( "Long-integer: number too large " + num ) ; } let stack = [ ] ; do { stack . push ( Math . floor ( num % 256 ) ) ; num = Math . floor ( num / 256 ) ; } while ( num ) ; Octet . encode ( data , stack . length ) ; while ( stack . length ) { Octet . encode ( data , stack . pop ( ) ) ; } return ; } let array = numOrArray ; if ( ( array . length < 1 ) || ( array . length > 30 ) ) { throw new CodeError ( "Long-integer: invalid length " + array . length ) ; } Octet . encode ( data , array . length ) ; Octet . encodeMultiple ( data , array ) ; }
@param data
        A wrapped object to store encoded raw data.
@param data A wrapped object to store encoded raw data .