Exemplo n.º 1
0
 // Fast-path append long data
 void append2(long l, int x) {
   if (_ls == null || _len >= _ls.length) append2slow();
   if (_len2 != _len) { // Sparse?
     if (x != 0) cancel_sparse(); // NA?  Give it up!
     else if (l == 0) {
       _len2++;
       return;
     } // Just One More Zero
     else x = _len2; // NZ: set the row over the xs field
   }
   _ls[_len] = l;
   _xs[_len++] = x;
   _len2++;
 }
Exemplo n.º 2
0
 // Fast-path append long data
 void append2(long l, int x) {
   if (_id == null || l != 0) {
     if (_ls == null || sparseLen() == _ls.length) {
       append2slow();
       // again call append2 since calling append2slow might have changed things (eg might have
       // switched to sparse and l could be 0)
       append2(l, x);
       return;
     }
     _ls[sparseLen()] = l;
     _xs[sparseLen()] = x;
     if (_id != null) _id[sparseLen()] = _len;
     set_sparseLen(sparseLen() + 1);
   }
   set_len(_len + 1);
   assert sparseLen() <= _len;
 }