KallistiOS git master
Independent SDK for the Sega Dreamcast
Loading...
Searching...
No Matches
string.h
Go to the documentation of this file.
1/* KallistiOS ##version##
2
3 kos/string.h
4 Copyright (C)2004 Megan Potter
5
6*/
7
8/** \file kos/string.h
9 \brief Variants on standard block memory copy/set functions.
10 \ingroup system_types
11
12 This file contains variants on the standard block memory copy/set functions.
13 These variants copy/set memory in the specified block sizes, which may be
14 helpful for interacting with memory-mapped hardware.
15
16 \author Megan Potter
17*/
18
19#ifndef __KOS_STRING_H
20#define __KOS_STRING_H
21
22#include <sys/cdefs.h>
23__BEGIN_DECLS
24
25#include <string.h>
26
27/** \addtogroup system_types
28 @{
29*/
30
31/** \brief Copy a block of memory, 4 bytes at a time.
32
33 This function is identical to memcpy(), except it copies 4 bytes at a time.
34
35 \param dest The destination of the copy.
36 \param src The source to copy.
37 \param count The number of bytes to copy. This should be
38 divisible by 4 (and will be rounded down if not).
39 \return The original value of dest.
40*/
41void * memcpy4(void * dest, const void *src, size_t count);
42
43/** \brief Set a block of memory, 4 bytes at a time.
44
45 This function is identical to memset(), except it sets 4 bytes at a time.
46 This implies that all 32-bits of c are used, not just the first 8 as in
47 memset().
48
49 \param s The destination of the set.
50 \param c The value to set to.
51 \param count The number of bytes to set. This should be
52 divisible by 4 (and will be rounded down if not).
53 \return The original value of dest.
54*/
55void * memset4(void * s, unsigned long c, size_t count);
56
57/** \brief Copy a block of memory, 2 bytes at a time.
58
59 This function is identical to memcpy(), except it copies 2 bytes at a time.
60
61 \param dest The destination of the copy.
62 \param src The source to copy.
63 \param count The number of bytes to copy. This should be
64 divisible by 2 (and will be rounded down if not).
65 \return The original value of dest.
66*/
67void * memcpy2(void * dest, const void *src, size_t count);
68
69/** \brief Set a block of memory, 2 bytes at a time.
70
71 This function is identical to memset(), except it sets 2 bytes at a time.
72 This implies that all 16-bits of c are used, not just the first 8 as in
73 memset().
74
75 \param s The destination of the set.
76 \param c The value to set to.
77 \param count The number of bytes to set. This should be
78 divisible by 2 (and will be rounded down if not).
79 \return The original value of dest.
80*/
81void * memset2(void * s, unsigned short c, size_t count);
82
83/** @} */
84
85__END_DECLS
86
87#endif /* __KOS_STRING_H */
88
89
void * memcpy2(void *dest, const void *src, size_t count)
Copy a block of memory, 2 bytes at a time.
void * memcpy4(void *dest, const void *src, size_t count)
Copy a block of memory, 4 bytes at a time.
void * memset2(void *s, unsigned short c, size_t count)
Set a block of memory, 2 bytes at a time.
void * memset4(void *s, unsigned long c, size_t count)
Set a block of memory, 4 bytes at a time.
Variants on standard block memory copy/set functions.