本文整理汇总了Java中water.util.UnsafeUtils.set2方法的典型用法代码示例。如果您正苦于以下问题:Java UnsafeUtils.set2方法的具体用法?Java UnsafeUtils.set2怎么用?Java UnsafeUtils.set2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类water.util.UnsafeUtils
的用法示例。
在下文中一共展示了UnsafeUtils.set2方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: bufS
import water.util.UnsafeUtils; //导入方法依赖的package包/类
private byte[] bufS(int len, int id_sz, int val_sz,boolean na_sparse){
long NA = CXIChunk.NA(val_sz);
int elem_size = id_sz+val_sz;
byte [] res = MemoryManager.malloc1(CXIChunk._OFF + _sparseLen*elem_size);
UnsafeUtils.set4(res,0,len);
res[4] = (byte)id_sz;
res[5] = (byte)val_sz;
res[6] = na_sparse?(byte)1:0;
if(na_sparse)res[6] = (byte)1;
for(int i = 0; i < _sparseLen; ++i){
if(id_sz == 2) UnsafeUtils.set2(res,CXIChunk._OFF+i*elem_size+0,(short)_id[i]);
else UnsafeUtils.set4(res,CXIChunk._OFF+i*elem_size+0,_id[i]);
long val = isNA2(i)?NA:_ms.get(i);
switch(val_sz){
case 0: break; // no value store dfor binary chunks
case 2: UnsafeUtils.set2(res,CXIChunk._OFF+i*elem_size+id_sz,(short)val); break;
case 4: UnsafeUtils.set4(res,CXIChunk._OFF+i*elem_size+id_sz,(int)val); break;
case 8: UnsafeUtils.set8(res,CXIChunk._OFF+i*elem_size+id_sz,val); break;
default: throw H2O.unimpl();
}
}
return res;
}
示例2: set_impl
import water.util.UnsafeUtils; //导入方法依赖的package包/类
@Override boolean set_impl(int idx, long l) {
long res = (long)(l/_scale)-_bias; // Compressed value
double d = (res+_bias)*_scale; // Reverse it
if( (long)d != l ) return false; // Does not reverse cleanly?
if( !(Short.MIN_VALUE < res && res <= Short.MAX_VALUE) ) return false; // Out-o-range for a short array
UnsafeUtils.set2(_mem,(idx<<1)+_OFF,(short)res);
return true;
}
示例3: set_impl
import water.util.UnsafeUtils; //导入方法依赖的package包/类
@Override boolean set_impl(int idx, long l) {
if( !(Short.MIN_VALUE < l && l <= Short.MAX_VALUE) ) return false;
UnsafeUtils.set2(_mem,(idx<<1)+_OFF,(short)l);
return true;
}
示例4: setMantissa
import water.util.UnsafeUtils; //导入方法依赖的package包/类
private void setMantissa(int i, short s){
UnsafeUtils.set2(_mem,(i*2)+_OFF,s);
}
示例5: setNA_impl
import water.util.UnsafeUtils; //导入方法依赖的package包/类
@Override boolean setNA_impl(int idx) { UnsafeUtils.set2(_mem,(idx<<1)+_OFF,(short)C2Chunk._NA); return true; }
示例6: setNA_impl
import water.util.UnsafeUtils; //导入方法依赖的package包/类
@Override boolean setNA_impl(int idx) { UnsafeUtils.set2(_mem,(idx<<1)+_OFF,(short)_NA); return true; }