Skip to content

Commit

Permalink
MDEV-34970 Vector search fails to compile on s390x
Browse files Browse the repository at this point in the history
add missing casts to float4store/float8store for bigendian.
fix a typo in float4store() usage
remove unnecessary one-byte-at-time appends
  • Loading branch information
vuvova committed Sep 21, 2024
1 parent d308f86 commit fd141e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions include/big_endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/*
Data in big-endian format.
*/
#define float4store(T,A) do { *(T)= ((uchar *) &A)[3];\
#define float4store(T,A) do { *((T)+0)=(char) ((uchar *) &A)[3];\
*((T)+1)=(char) ((uchar *) &A)[2];\
*((T)+2)=(char) ((uchar *) &A)[1];\
*((T)+3)=(char) ((uchar *) &A)[0]; } while(0)
Expand All @@ -28,7 +28,7 @@
((uchar*) &def_temp)[3]=(M)[0];\
(V)=def_temp; } while(0)

#define float8store(T,V) do { *(T)= ((uchar *) &V)[7];\
#define float8store(T,V) do { *((T)+0)=(char) ((uchar *) &V)[7];\
*((T)+1)=(char) ((uchar *) &V)[6];\
*((T)+2)=(char) ((uchar *) &V)[5];\
*((T)+3)=(char) ((uchar *) &V)[4];\
Expand Down
7 changes: 2 additions & 5 deletions sql/item_vectorfunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,8 @@ String *Item_func_vec_fromtext::val_str(String *buf)
goto error_format;

char f_bin[4];
float4store(&f_bin, f);
buf->append(f_bin[0]);
buf->append(f_bin[1]);
buf->append(f_bin[2]);
buf->append(f_bin[3]);
float4store(f_bin, f);
buf->append(f_bin, sizeof(f_bin));
break;
}
default:
Expand Down

0 comments on commit fd141e4

Please sign in to comment.