Skip to content

Commit 0d625e1

Browse files
Pekka NousiainenPiotr Obrzut
authored andcommitted
wl#7614 sparc-bit.diff
bit(x) fix for sparc (cherry picked from commit ecae44ecc35ee746b856ef124be39c8afd22bb7d)
1 parent 75e52b6 commit 0d625e1

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

storage/ndb/tools/NdbImportCsv.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,6 +1783,7 @@ NdbImportCsv::Eval::eval_field(Row* row, Line* line, Field* field)
17831783
uint bytelength = (attr.m_length + 7) / 8;
17841784
require(bytelength <= 8);
17851785
uchar val[8];
1786+
memset(val, 0, sizeof(val));
17861787
uint i = 0;
17871788
uint j = Inval_uint; // highest non-zero byte
17881789
while (i < length)
@@ -1794,11 +1795,6 @@ NdbImportCsv::Eval::eval_field(Row* row, Line* line, Field* field)
17941795
val[i] = b;
17951796
i++;
17961797
}
1797-
while (i < bytelength)
1798-
{
1799-
val[i] = 0;
1800-
i++;
1801-
}
18021798
if (j != Inval_uint)
18031799
{
18041800
uint k = 8; // highest bit at j
@@ -1819,7 +1815,13 @@ NdbImportCsv::Eval::eval_field(Row* row, Line* line, Field* field)
18191815
break;
18201816
}
18211817
}
1822-
attr.set_value(row, val, bytelength);
1818+
#if defined(WORDS_BIGENDIAN)
1819+
std::swap(val[0], val[3]);
1820+
std::swap(val[1], val[2]);
1821+
std::swap(val[4], val[7]);
1822+
std::swap(val[5], val[6]);
1823+
#endif
1824+
attr.set_value(row, val, attr.m_size);
18231825
}
18241826
break;
18251827
case NdbDictionary::Column::Year:

storage/ndb/tools/NdbImportCsv.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
#include <NdbImport.hpp>
2525
#include "NdbImportUtil.hpp"
2626
#include <my_regex.h>
27+
// STL
28+
#include <algorithm>
2729

2830
/*
2931
* CSV helper class. There is one Csv instance attached to the Impl

0 commit comments

Comments
 (0)