Example #1
0
jint sun_io_CharToByteISO8859_11::convert(
	Unicod_ap  aUnicod1,	// src
	jint  c_offset,
	jint  c_end,
	Byte_ap  aByte4,		// dst
	jint  b_offset,
	jint  b_end
) {
	int c_length = c_end - c_offset;
	int b_length = b_end - b_offset;
	if (c_length == 0) {
		return 0;//Unicod_A::create$(0);
	}
	Byte_A::Buffer b_buf(aByte4, b_offset, b_length);
	Unicod_A::Buffer c_buf(aUnicod1, c_offset, c_length);
	if (c_length > b_length) {
		c_length = b_length;
	}
	jbyte* pB = b_buf;
	unicod* pC = c_buf;
	for (int i = c_length; i -- > 0; ) {
		*pB ++ = (jbyte)*pC++;
	}
	this->set__byteOff(b_offset + c_length);
	return c_length;
}
Example #2
0
jint sun_io_ByteToCharISO8859_11::convert(
	Byte_ap  aByte1,	// src
	jint  b_offset,
	jint  b_end,
	Unicod_ap  aUnicod4, // dst
	jint  c_offset,
	jint  c_end
) {
	int c_length = c_end - c_offset;
	int b_length = b_end - b_offset;
	if (b_length == 0) {
		return 0;//Unicod_A::create$(0);
	}
	Byte_A::Buffer b_buf(aByte1, b_offset, b_length);
	Unicod_A::Buffer c_buf(aUnicod4, c_offset, c_length);
	if (b_length > c_length) {
		b_length = c_length;
	}
	jbyte* pB = b_buf;
	unicod* pC = c_buf;
	for (int i = b_length; i -- > 0; ) {
		*pC ++ = *pB++;
	}
//*
	this->set__charOff(c_offset + b_length);
	return c_length;
/*/
	this->set__charOff(c_offset + b_length);
	return c_length;
//*/
	//return fm::byteToCharArray((ubyte*)(jbyte*)buf, length);
}
Example #3
0
void TestQgsOpenClUtils::_testMakeRunProgram()
{

  cl_int err = 0;

  QVERIFY( err == 0 );

  cl::Context ctx = QgsOpenClUtils::context();
  cl::CommandQueue queue = QgsOpenClUtils::commandQueue();

  std::vector<float> a_vec = {1, 10, 100};
  std::vector<float> b_vec = {1, 10, 100};
  std::vector<float> c_vec = {-1, -1, -1};
  cl::Buffer a_buf( queue, a_vec.begin(), a_vec.end(), true );
  cl::Buffer b_buf( queue, b_vec.begin(), b_vec.end(), true );
  cl::Buffer c_buf( queue, c_vec.begin(), c_vec.end(), false );

  cl::Program program = QgsOpenClUtils::buildProgram( QString::fromStdString( source() ) );

  auto kernel =
    cl::KernelFunctor <
    cl::Buffer &,
    cl::Buffer &,
    cl::Buffer &
    > ( program, "vectorAdd" );

  kernel( cl::EnqueueArgs(
            queue,
            cl::NDRange( 3 )
          ),
          a_buf,
          b_buf,
          c_buf
        );

  cl::copy( queue, c_buf, c_vec.begin(), c_vec.end() );
  for ( size_t i = 0; i < c_vec.size(); ++i )
  {
    QCOMPARE( c_vec[i], a_vec[i] + b_vec[i] );
  }
}