将UInt64数组转换为BitVector

时间:2018-05-22 04:14:58

标签: arrays julia bitset

我最近发现我可以使用chunksUInt64获取BitVector的“支持数组”。但是,我想采用相反的方式 - 给定一个foo的一维数组,使用某个函数foo(x.chunks) == x构造一个 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final ToggleButton togShortCircuit = (ToggleButton) findViewById(R.id.togShortCircuit); togShortCircuit.setClickable(false); final EditText txtOCVListen = (EditText) findViewById(R.id.txtOCV); txtOCVListen.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { txtOCVListen.setFilters(new InputFilter[]{new CustomRangeInputFilter(0f, 16.0f)}); } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if(txtOCVListen.getText().toString().equals(null) || txtOCVListen.getText().toString().equals("")){ fltOCV = 0; } else { fltOCV = Float.parseFloat(txtOCVListen.getText().toString()); } //Short Circuit if (fltOCV < 10.6 && fltULV > 0 && fltULV <= 8.5) { TextView lblShortCircuitStatus = (TextView) findViewById(R.id.lblShortCircuitStatus); lblShortCircuitStatus.setText("True"); lblShortCircuitStatus.setTextColor(0xFFD51817); //Red togShortCircuit.setChecked(true); } else { TextView lblShortCircuitStatus = (TextView) findViewById(R.id.lblShortCircuitStatus); lblShortCircuitStatus.setText("False"); lblShortCircuitStatus.setTextColor(0xFF808080); //Grey togShortCircuit.setChecked(false); } ,以便

test_playbook/ ├── dep_test.yaml ├── my_hosts_file └── roles ├── common │   └── vars │   └── main.yaml ├── dep_test │   ├── meta │   │   └── main.yaml │   └── tasks │   └── main.yaml ├── dep_test_a │   └── tasks │   └── main.yaml └── dep_test_b ├── meta │   └── main.yaml └── tasks └── main.yaml

这样的功能是否存在?

1 个答案:

答案 0 :(得分:3)

this这样的东西会起作用吗?

function foo(v::Vector{UInt64})
    siz = sizeof(v)
    bv = falses(siz << 6)
    unsafe_copy!(reinterpret(Ptr{UInt64}, pointer(bv.chunks)), pointer(v), siz)
    bv
end

如果需要,它们还提供过载以设置结果BitVector中的位数。