mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Correction for printing long type variables in 32-bit system (#2094)
Due to change request from #2037
This commit is contained in:
@@ -81,7 +81,6 @@ struct printDataGenParameters
|
|||||||
|
|
||||||
// Reference results - filled out at run-time
|
// Reference results - filled out at run-time
|
||||||
static std::vector<std::string> correctBufferInt;
|
static std::vector<std::string> correctBufferInt;
|
||||||
static std::vector<std::string> correctBufferLong;
|
|
||||||
static std::vector<std::string> correctBufferHalf;
|
static std::vector<std::string> correctBufferHalf;
|
||||||
static std::vector<std::string> correctBufferFloat;
|
static std::vector<std::string> correctBufferFloat;
|
||||||
static std::vector<std::string> correctBufferDouble;
|
static std::vector<std::string> correctBufferDouble;
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
// Helpers for generating runtime reference results
|
// Helpers for generating runtime reference results
|
||||||
static void intRefBuilder(printDataGenParameters&, char*, const size_t);
|
static void intRefBuilder(printDataGenParameters&, char*, const size_t);
|
||||||
static void longRefBuilder(printDataGenParameters&, char*, const size_t);
|
|
||||||
static void halfRefBuilder(printDataGenParameters&, char* rResult,
|
static void halfRefBuilder(printDataGenParameters&, char* rResult,
|
||||||
const size_t);
|
const size_t);
|
||||||
static void floatRefBuilder(printDataGenParameters&, char* rResult, const size_t);
|
static void floatRefBuilder(printDataGenParameters&, char* rResult, const size_t);
|
||||||
@@ -158,6 +157,33 @@ std::vector<printDataGenParameters> printLongGenParameters = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//--------------------------------------------------------
|
||||||
|
|
||||||
|
// Lookup table - [string]long-correct buffer |
|
||||||
|
|
||||||
|
//--------------------------------------------------------
|
||||||
|
|
||||||
|
// The table below is used to accommodate differences in `printf` output when
|
||||||
|
// using the `%ld` format specifier in 32-bit versus 64-bit compiled binaries
|
||||||
|
|
||||||
|
std::vector<std::string> correctBufferLong = {
|
||||||
|
|
||||||
|
"10000000000",
|
||||||
|
|
||||||
|
"-10000000000 ",
|
||||||
|
|
||||||
|
"000010000000000",
|
||||||
|
|
||||||
|
" -10000000000",
|
||||||
|
|
||||||
|
"+10000000000 ",
|
||||||
|
|
||||||
|
"000010000000000",
|
||||||
|
|
||||||
|
"-000010000000000"
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
//-----------------------------------------------
|
//-----------------------------------------------
|
||||||
|
|
||||||
// test case for long |
|
// test case for long |
|
||||||
@@ -172,7 +198,7 @@ testCase testCaseLong = {
|
|||||||
|
|
||||||
printLongGenParameters,
|
printLongGenParameters,
|
||||||
|
|
||||||
longRefBuilder,
|
NULL,
|
||||||
|
|
||||||
klong
|
klong
|
||||||
|
|
||||||
@@ -1594,13 +1620,6 @@ static void intRefBuilder(printDataGenParameters& params, char* refResult, const
|
|||||||
atoi(params.dataRepresentation));
|
atoi(params.dataRepresentation));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void longRefBuilder(printDataGenParameters& params, char* refResult,
|
|
||||||
const size_t refSize)
|
|
||||||
{
|
|
||||||
snprintf(refResult, refSize, params.genericFormats.front().c_str(),
|
|
||||||
atoll(params.dataRepresentation));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void halfRefBuilder(printDataGenParameters& params, char* refResult,
|
static void halfRefBuilder(printDataGenParameters& params, char* refResult,
|
||||||
const size_t refSize)
|
const size_t refSize)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user