mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-04 23:56:39 +08:00
Fix printf for type BYTE and SHORT
Generated instructions writing to printf buffer require destination address to be DWORD aligned. Because of that values of type BYTE (1B) and SHORT (2B) need to be written as 4B value. This change adds support for this. When trying to read value of type BYTE or SHORT four bytes are actually read to be aligned with compiler implementation. Signed-off-by: Krystian Chmielewski <krystian.chmielewski@intel.com>
This commit is contained in:
committed by
Compute-Runtime-Automation
parent
90ba50bf52
commit
b04c226767
@@ -82,8 +82,10 @@ class PrintFormatter {
|
||||
|
||||
template <class T>
|
||||
size_t typedPrintToken(char *output, size_t size, const char *formatString) {
|
||||
T value = {0};
|
||||
T value{0};
|
||||
read(&value);
|
||||
constexpr auto offsetToBeDwordAligned = static_cast<uint32_t>(std::max(int64_t(sizeof(int) - sizeof(T)), int64_t(0)));
|
||||
currentOffset += offsetToBeDwordAligned;
|
||||
return simpleSprintf(output, size, formatString, value);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user