summaryrefslogtreecommitdiff
path: root/libpsx/include/strings.h
blob: c654055c3c3196bb5f7b22a4f659c9b354066229 (plain) (blame)
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
38
39
40
41
42
43
44
45
46
/*
 * strings.h
 *
 * PSXSDK
 */

#ifndef _STRINGS_H
#define _STRINGS_H

#ifdef __cplusplus
extern "C"
{
#endif

#include <string.h>
#include <types.h>

#define bcopy(src,dst,len)				memmove(dst,src,len)
#define bzero(ptr, len)					memset(ptr, 0, len)
#define bcmp(b1,b2,len)					memcmp(b1,b2,len)
#define index(s, c)						strchr(s, c)
#define rindex(s, c)						strrchr(s, c)

int ffs(int value);
char *index(const char *s, int c);
char *rindex(const char *s, int c);

/**
 * Returns the number of bits set in the value
 * @param value Value
 * @return Number of bits set in value
 */

unsigned int popcount(unsigned int value);
unsigned int popcountl(unsigned long value);
unsigned int popcountll(unsigned long long value);
unsigned int popcount32(uint32_t value);
unsigned int popcount64(uint64_t value);
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t len);

#ifdef __cplusplus
}
#endif

#endif