Commit 0df34630 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-29959 fix for aarch64

on aarch64 `char` by default is unsigned for performance reasons.
let's adjust checks to work for both signed and unsigned `char`

followup for ef84f813
parent 1570c6e3
......@@ -95,7 +95,7 @@ class UUID: public FixedBinTypeStorage<MY_UUID_SIZE, MY_UUID_STRING_LENGTH>
}
if (str < end)
goto err; // Some input left
if (m_buffer[6] < 0 && m_buffer[8] > 0)
if (m_buffer[6] & -m_buffer[8] & 0x80)
goto err; // impossible combination: version >= 8, variant = 0
return false;
err:
......@@ -176,7 +176,7 @@ class UUID: public FixedBinTypeStorage<MY_UUID_SIZE, MY_UUID_STRING_LENGTH>
// Convert the in-memory representation to the in-record representation
static void memory_to_record(char *to, const char *from)
{
if (force_swap || (from[6] > 0 && from[6] < 0x60 && from[8] < 0))
if (force_swap || (from[6] > 0 && from[6] < 0x60 && from[8] & 0x80))
{
segment(0).memory_to_record(to, from);
segment(1).memory_to_record(to, from);
......@@ -191,7 +191,7 @@ class UUID: public FixedBinTypeStorage<MY_UUID_SIZE, MY_UUID_STRING_LENGTH>
// Convert the in-record representation to the in-memory representation
static void record_to_memory(char *to, const char *from)
{
if (force_swap || (from[6] < 0 && from[8] > 0))
if (force_swap || (from[6] & -from[8] & 0x80))
{
segment(0).record_to_memory(to, from);
segment(1).record_to_memory(to, from);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment