Exemplo n.º 1
0
NATIVEMETHOD(jlong, NativeBase, nativeUseCount)(
  JNIEnv*,
  jobject,
  jlong addrA,
  jlong addrB
) {
  TwoAddrs bufA(addrA, addrB);
  return bufA.as_NativeObjPtr().use_count();
}
Exemplo n.º 2
0
NATIVEMETHOD(void, NativeBase, nativeReset)(
  JNIEnv*,
  jobject,
  jlong addrA,
  jlong addrB
) {
  TwoAddrs bufA(addrA, addrB);
  bufA.as_NativeObjPtr().reset();
  // The Scala object fields are cleared in the wrapper
}
Exemplo n.º 3
0
NATIVEMETHOD(void, NativeBase, copyAssign)(
  JNIEnv* env,
  jobject thisJ,
  jobject srcJ
) {
  if (thisJ == srcJ) return;
  auto info = get_info(env, __LINE__);
  TwoAddrs bufA(env, thisJ, info);
  TwoAddrs bufB(env, srcJ, info);
  bufA.as_NativeObjPtr() = bufB.as_NativeObjPtr();
  bufA.copy_to_scala(env, thisJ, info);
}
Exemplo n.º 4
0
int main(int, char **)
{
    Halide::Buffer<uint8_t> bufA(NN, NN);
    Halide::Buffer<uint8_t> output_buf(NN, NN);
    Halide::Buffer<uint8_t> reference_buf(NN, NN);
    init_buffer(output_buf, (uint8_t) 177);
    // Dummy data
    for (int i = 0; i < NN; i++) {
        for (int j = 0; j < NN; j++) {
            bufA(j, i) = i * 10 + j;
        }
    }
    for (int i = 0; i < NN; i++) {
        for (int j = 0; j < NN; j++) {
            // Same access pattern as in generator
            reference_buf((i + j * (NN - 1)) % NN, (i + j * 2) % NN) = bufA((j + 3) % NN, i);
        }
    }

    func(bufA.raw_buffer(), output_buf.raw_buffer());
    compare_buffers("test", output_buf, reference_buf);

    return 0;
}