File: revseqcmp.h

package info (click to toggle)
phylonium 1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 44,340 kB
  • sloc: cpp: 15,701; ansic: 782; makefile: 139; python: 66; sh: 41
file content (37 lines) | stat: -rw-r--r-- 853 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
34
35
36
37
/**
 * SPDX-License-Identifier: GPL-3.0-or-later
 * Copyright 2019 © Fabian Klötzl
 */
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <stddef.h>
#include "config.h"

/** @brief Check whether two characters are complementary.
 * @param c - One nucleotide.
 * @param d - A nucleotide from the other sequence.
 * @returns true iff the two nucleotides are complements.
 */
inline int is_complement(char c, char d)
{
	int xorr = c ^ d;
	return (xorr & 6) == 4;
}

size_t revseqcmp(const char *begin, const char *other, size_t length);

#ifdef ENABLE_X86_SIMD
size_t revseqcmp_ssse3(const char *begin, const char *other, size_t length);
size_t revseqcmp_avx2(const char *begin, const char *other, size_t length);
#endif

typedef size_t(revseqcmp_fn)(const char *begin, const char *other,
							 size_t length);

#ifdef __cplusplus
}
#endif