File: funCompareUintAndSuffixesMemcmp.cpp

package info (click to toggle)
rna-star 2.7.8a%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 3,076 kB
  • sloc: cpp: 20,429; awk: 483; ansic: 470; makefile: 181; sh: 31
file content (33 lines) | stat: -rw-r--r-- 1,205 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "funCompareUintAndSuffixesMemcmp.h"
#include <string.h> //for memcmp

char* g_funCompareUintAndSuffixesMemcmp_G;
uint64_t g_funCompareUintAndSuffixesMemcmp_L;

int funCompareUintAndSuffixesMemcmp ( const void *a, const void *b)
{
    uint64_t* va= ((uint64_t*) a);
    uint64_t* vb= ((uint64_t*) b);

    if (va[0]>vb[0])
    {
        return 1;
    } else if (va[0]<vb[0])
    {
        return -1;
    } else
    {//compare suffixes
//         char *p5=(char*) memchr(g_funCompareUintAndSuffixesMemcmp_G+va[1],5,g_funCompareUintAndSuffixesMemcmp_L); //first encounter of char=5
//         char *p5=g_funCompareUintAndSuffixesMemcmp_G+va[1]+g_funCompareUintAndSuffixesMemcmp_L;
        //compare suffixes but only until first char=5
//         int comp=memcmp(g_funCompareUintAndSuffixesMemcmp_G+va[1],g_funCompareUintAndSuffixesMemcmp_G+vb[1],p5+1-(g_funCompareUintAndSuffixesMemcmp_G+va[1]));
        int comp=memcmp(g_funCompareUintAndSuffixesMemcmp_G+va[1],g_funCompareUintAndSuffixesMemcmp_G+vb[1],g_funCompareUintAndSuffixesMemcmp_L);

        if (comp==0)
        {
            comp=va[1]>vb[1] ? 1 : -1;
        };
//         int comp=va[1]>vb[1] ? 1 : -1;
        return comp;
    };
};