mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
make 64-bit safe
This commit is contained in:
parent
00f2d43ec1
commit
6e789ec480
@ -202,10 +202,12 @@ read(istream &in) {
|
|||||||
for (int i = 0; i < size; ++i) {
|
for (int i = 0; i < size; ++i) {
|
||||||
LPoint3f point = LPoint3f::zero();
|
LPoint3f point = LPoint3f::zero();
|
||||||
for (int ci = 0; ci < _num_channels; ++ci) {
|
for (int ci = 0; ci < _num_channels; ++ci) {
|
||||||
float data;
|
PN_float32 data;
|
||||||
in.read((char *)&data, sizeof(data));
|
in.read((char *)&data, sizeof(data));
|
||||||
LittleEndian value(&data, sizeof(data));
|
LittleEndian value(&data, sizeof(data));
|
||||||
value.store_value(&(point[ci]), sizeof(point[ci]));
|
PN_float32 result;
|
||||||
|
value.store_value(&result, sizeof(result));
|
||||||
|
point[ci] = result;
|
||||||
}
|
}
|
||||||
_table.push_back(point);
|
_table.push_back(point);
|
||||||
}
|
}
|
||||||
@ -213,10 +215,12 @@ read(istream &in) {
|
|||||||
for (int i = 0; i < size; ++i) {
|
for (int i = 0; i < size; ++i) {
|
||||||
LPoint3f point = LPoint3f::zero();
|
LPoint3f point = LPoint3f::zero();
|
||||||
for (int ci = 0; ci < _num_channels; ++ci) {
|
for (int ci = 0; ci < _num_channels; ++ci) {
|
||||||
float data;
|
PN_float32 data;
|
||||||
in.read((char *)&data, sizeof(data));
|
in.read((char *)&data, sizeof(data));
|
||||||
BigEndian value(&data, sizeof(data));
|
BigEndian value(&data, sizeof(data));
|
||||||
value.store_value(&(point[ci]), sizeof(point[ci]));
|
PN_float32 result;
|
||||||
|
value.store_value(&result, sizeof(result));
|
||||||
|
point[ci] = result;
|
||||||
}
|
}
|
||||||
_table.push_back(point);
|
_table.push_back(point);
|
||||||
}
|
}
|
||||||
@ -226,6 +230,7 @@ read(istream &in) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nassertr(sizeof(PN_float32) == 4, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +290,7 @@ write(ostream &out) {
|
|||||||
for (int i = 0; i < size; ++i) {
|
for (int i = 0; i < size; ++i) {
|
||||||
const LPoint3f &point = _table[i];
|
const LPoint3f &point = _table[i];
|
||||||
for (int ci = 0; ci < _num_channels; ++ci) {
|
for (int ci = 0; ci < _num_channels; ++ci) {
|
||||||
float data = point[ci];
|
PN_float32 data = point[ci];
|
||||||
out.write((const char *)&data, sizeof(data));
|
out.write((const char *)&data, sizeof(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,6 +298,7 @@ write(ostream &out) {
|
|||||||
if (out.fail()) {
|
if (out.fail()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
nassertr(sizeof(PN_float32) == 4, false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user