Added BE64 and LE64 types.

committer: mfx <mfx> 1126183138 +0000
This commit is contained in:
Markus F.X.J. Oberhumer
2005-09-08 12:38:58 +00:00
parent 5d9b6d056d
commit 24ffaa0738
4 changed files with 159 additions and 0 deletions
+44
View File
@@ -61,6 +61,13 @@ int __acc_cdecl_qsort be32_compare(const void *e1, const void *e2)
return (d1 < d2) ? -1 : ((d1 > d2) ? 1 : 0);
}
int __acc_cdecl_qsort be64(const void *e1, const void *e2)
{
const acc_uint64l_t d1 = get_be64(e1);
const acc_uint64l_t d2 = get_be64(e2);
return (d1 < d2) ? -1 : ((d1 > d2) ? 1 : 0);
}
int __acc_cdecl_qsort le16_compare(const void *e1, const void *e2)
{
const unsigned d1 = get_le16(e1);
@@ -75,6 +82,13 @@ int __acc_cdecl_qsort le32_compare(const void *e1, const void *e2)
return (d1 < d2) ? -1 : ((d1 > d2) ? 1 : 0);
}
int __acc_cdecl_qsort le64(const void *e1, const void *e2)
{
const acc_uint64l_t d1 = get_le64(e1);
const acc_uint64l_t d2 = get_le64(e2);
return (d1 < d2) ? -1 : ((d1 > d2) ? 1 : 0);
}
int __acc_cdecl_qsort be16_compare_signed(const void *e1, const void *e2)
{
@@ -90,6 +104,13 @@ int __acc_cdecl_qsort be32_compare_signed(const void *e1, const void *e2)
return (d1 < d2) ? -1 : ((d1 > d2) ? 1 : 0);
}
int __acc_cdecl_qsort be64_compare_signed(const void *e1, const void *e2)
{
const acc_int64l_t d1 = get_be64_signed(e1);
const acc_int64l_t d2 = get_be64_signed(e2);
return (d1 < d2) ? -1 : ((d1 > d2) ? 1 : 0);
}
int __acc_cdecl_qsort le16_compare_signed(const void *e1, const void *e2)
{
const int d1 = get_le16_signed(e1);
@@ -104,6 +125,13 @@ int __acc_cdecl_qsort le32_compare_signed(const void *e1, const void *e2)
return (d1 < d2) ? -1 : ((d1 > d2) ? 1 : 0);
}
int __acc_cdecl_qsort le64_compare_signed(const void *e1, const void *e2)
{
const acc_int64l_t d1 = get_le64_signed(e1);
const acc_int64l_t d2 = get_le64_signed(e2);
return (d1 < d2) ? -1 : ((d1 > d2) ? 1 : 0);
}
/*************************************************************************
// find util
@@ -143,6 +171,14 @@ int find_be32(const void *b, int blen, unsigned what)
}
int find_be64(const void *b, int blen, acc_uint64l_t what)
{
unsigned char w[8];
set_be64(w, what);
return find(b, blen, w, 8);
}
int find_le16(const void *b, int blen, unsigned what)
{
unsigned char w[2];
@@ -159,6 +195,14 @@ int find_le32(const void *b, int blen, unsigned what)
}
int find_le64(const void *b, int blen, acc_uint64l_t what)
{
unsigned char w[8];
set_le64(w, what);
return find(b, blen, w, 8);
}
/*************************************************************************
// find util
**************************************************************************/