fromByteList static method

int fromByteList(
  1. bool lsbFirst,
  2. int len,
  3. bool signed,
  4. List<int> data
)

Implementation

static int fromByteList(bool lsbFirst, int len, bool signed, List<int> data) {
  int val = 0;
  if (lsbFirst) {
    len--;
    val = signed ? data[len] : (data[len] & 0xFF);
    while (len > 0) {
      len--;
      val = val << 8;
      val |= (data[len] & 0xFF);
    }
  } else {
    int i = 0;
    val = signed ? data[len] : data[len] & 0xFF;
    while (i < len) {
      i++;
      val = val << 8;
      val |= (data[i] & 0xFF);
    }
  }
  return val;
}