Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions openmp/libompd/src/TargetValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,22 +231,27 @@ class TBaseValue : public TValue {

template <typename T> ompd_rc_t TBaseValue::getValue(T &buf) {
assert(sizeof(T) >= baseTypeSize);
ompd_rc_t ret = getValue(&buf, 1);
if (sizeof(T) > baseTypeSize) {
switch (baseTypeSize) {
case 1:
buf = (T) * ((int8_t *)&buf);
break;
case 2:
buf = (T) * ((int16_t *)&buf);
break;
case 4:
buf = (T) * ((int32_t *)&buf);
break;
case 8:
buf = (T) * ((int64_t *)&buf);
break;
}
if (sizeof(T) == baseTypeSize)
return getValue(&buf, 1);

char tmp[sizeof(T)];
ompd_rc_t ret = getValue(tmp, 1);
switch (baseTypeSize) {
case 1:
buf = (T) * ((int8_t *)tmp);
break;
case 2:
buf = (T) * ((int16_t *)tmp);
break;
case 4:
buf = (T) * ((int32_t *)tmp);
break;
case 8:
buf = (T) * ((int64_t *)tmp);
break;
default:
assert(0 && "Invalid baseTypeSize");
break;
}
return ret;
}
Expand Down