예제 #1
0
py::array_t<EnumStruct, 0> create_enum_array(size_t n) {
    auto arr = mkarray_via_buffer<EnumStruct>(n);
    auto ptr = (EnumStruct *) arr.mutable_data();
    for (size_t i = 0; i < n; i++) {
        ptr[i].e1 = static_cast<E1>(-1 + ((int) i % 2) * 2);
        ptr[i].e2 = static_cast<E2>(1 + (i % 2));
    }
    return arr;
}
예제 #2
0
/*
* Left Shift Operator
*/
BigInt& BigInt::operator<<=(size_t shift)
{
    if(shift)
    {
        const size_t shift_words = shift / MP_WORD_BITS,
                     shift_bits  = shift % MP_WORD_BITS,
                     words = sig_words();

        grow_to(words + shift_words + (shift_bits ? 1 : 0));
        bigint_shl1(mutable_data(), words, shift_words, shift_bits);
    }

    return (*this);
}
예제 #3
0
파일: tensor.hpp 프로젝트: zhxfl/purine2
 inline DTYPE* mutable_cpu_data() {
   CHECK(device_ < 0);
   return mutable_data();
 }
예제 #4
0
파일: tensor.hpp 프로젝트: zhxfl/purine2
 inline DTYPE* mutable_gpu_data() {
   CHECK(device_ >= 0);
   return mutable_data();
 }
예제 #5
0
파일: slice.hpp 프로젝트: alexey2k/ft-index
 char *end() { return mutable_data() + size(); }
예제 #6
0
파일: slice.hpp 프로젝트: alexey2k/ft-index
 char *begin() { return mutable_data(); }