Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0b5e33f

Browse files
committed
Remove use of byte-masking macros in record_image_cmp
These were introduced in 4cbb646, but after further analysis and testing, they should not be necessary and probably weren't the part of that commit that fixed anything. Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
1 parent 4a3fdbd commit 0b5e33f

File tree

1 file changed

+3
-62
lines changed

1 file changed

+3
-62
lines changed

src/backend/utils/adt/rowtypes.c

Lines changed: 3 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,45 +1467,8 @@ record_image_cmp(FunctionCallInfo fcinfo)
14671467
}
14681468
else if (att1->attbyval)
14691469
{
1470-
switch (att1->attlen)
1471-
{
1472-
case 1:
1473-
if (GET_1_BYTE(values1[i1]) !=
1474-
GET_1_BYTE(values2[i2]))
1475-
{
1476-
cmpresult = (GET_1_BYTE(values1[i1]) <
1477-
GET_1_BYTE(values2[i2])) ? -1 : 1;
1478-
}
1479-
break;
1480-
case 2:
1481-
if (GET_2_BYTES(values1[i1]) !=
1482-
GET_2_BYTES(values2[i2]))
1483-
{
1484-
cmpresult = (GET_2_BYTES(values1[i1]) <
1485-
GET_2_BYTES(values2[i2])) ? -1 : 1;
1486-
}
1487-
break;
1488-
case 4:
1489-
if (GET_4_BYTES(values1[i1]) !=
1490-
GET_4_BYTES(values2[i2]))
1491-
{
1492-
cmpresult = (GET_4_BYTES(values1[i1]) <
1493-
GET_4_BYTES(values2[i2])) ? -1 : 1;
1494-
}
1495-
break;
1496-
#if SIZEOF_DATUM == 8
1497-
case 8:
1498-
if (GET_8_BYTES(values1[i1]) !=
1499-
GET_8_BYTES(values2[i2]))
1500-
{
1501-
cmpresult = (GET_8_BYTES(values1[i1]) <
1502-
GET_8_BYTES(values2[i2])) ? -1 : 1;
1503-
}
1504-
break;
1505-
#endif
1506-
default:
1507-
Assert(false); /* cannot happen */
1508-
}
1470+
if (values1[i1] != values2[i2])
1471+
cmpresult = (values1[i1] < values2[i2]) ? -1 : 1;
15091472
}
15101473
else
15111474
{
@@ -1739,29 +1702,7 @@ record_image_eq(PG_FUNCTION_ARGS)
17391702
}
17401703
else if (att1->attbyval)
17411704
{
1742-
switch (att1->attlen)
1743-
{
1744-
case 1:
1745-
result = (GET_1_BYTE(values1[i1]) ==
1746-
GET_1_BYTE(values2[i2]));
1747-
break;
1748-
case 2:
1749-
result = (GET_2_BYTES(values1[i1]) ==
1750-
GET_2_BYTES(values2[i2]));
1751-
break;
1752-
case 4:
1753-
result = (GET_4_BYTES(values1[i1]) ==
1754-
GET_4_BYTES(values2[i2]));
1755-
break;
1756-
#if SIZEOF_DATUM == 8
1757-
case 8:
1758-
result = (GET_8_BYTES(values1[i1]) ==
1759-
GET_8_BYTES(values2[i2]));
1760-
break;
1761-
#endif
1762-
default:
1763-
Assert(false); /* cannot happen */
1764-
}
1705+
result = (values1[i1] == values2[i2]);
17651706
}
17661707
else
17671708
{

0 commit comments

Comments
 (0)