MDEV-34970 Vector search fails to compile on s390x

add missing casts to float4store/float8store for bigendian.
fix a typo in float4store() usage
remove unnecessary one-byte-at-time appends
This commit is contained in:
Sergei Golubchik 2024-09-21 11:57:19 +02:00
parent 3c6e836110
commit a471389d07
2 changed files with 4 additions and 7 deletions

View file

@ -16,7 +16,7 @@
/* /*
Data in big-endian format. 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)+1)=(char) ((uchar *) &A)[2];\
*((T)+2)=(char) ((uchar *) &A)[1];\ *((T)+2)=(char) ((uchar *) &A)[1];\
*((T)+3)=(char) ((uchar *) &A)[0]; } while(0) *((T)+3)=(char) ((uchar *) &A)[0]; } while(0)
@ -28,7 +28,7 @@
((uchar*) &def_temp)[3]=(M)[0];\ ((uchar*) &def_temp)[3]=(M)[0];\
(V)=def_temp; } while(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)+1)=(char) ((uchar *) &V)[6];\
*((T)+2)=(char) ((uchar *) &V)[5];\ *((T)+2)=(char) ((uchar *) &V)[5];\
*((T)+3)=(char) ((uchar *) &V)[4];\ *((T)+3)=(char) ((uchar *) &V)[4];\

View file

@ -179,11 +179,8 @@ String *Item_func_vec_fromtext::val_str(String *buf)
goto error_format; goto error_format;
char f_bin[4]; char f_bin[4];
float4store(&f_bin, f); float4store(f_bin, f);
buf->append(f_bin[0]); buf->append(f_bin, sizeof(f_bin));
buf->append(f_bin[1]);
buf->append(f_bin[2]);
buf->append(f_bin[3]);
break; break;
} }
default: default: