2 * libc-style definitions and functions
4 * Copyright (c) 2013 Alexander Graf <agraf@suse.de>
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
12 #ifndef S390_CCW_LIBC_H
13 #define S390_CCW_LIBC_H
15 typedef unsigned long size_t;
17 typedef unsigned char uint8_t;
18 typedef unsigned short uint16_t;
19 typedef unsigned int uint32_t;
20 typedef unsigned long long uint64_t;
22 static inline void *memset(void *s
, int c
, size_t n
)
27 for (i
= 0; i
< n
; i
++) {
34 static inline void *memcpy(void *s1
, const void *s2
, size_t n
)
37 const uint8_t *src
= s2
;
40 for (i
= 0; i
< n
; i
++) {
47 static inline int memcmp(const void *s1
, const void *s2
, size_t n
)
50 const uint8_t *p1
= s1
, *p2
= s2
;
52 for (i
= 0; i
< n
; i
++) {
54 return p1
[i
] > p2
[i
] ? 1 : -1;
61 static inline size_t strlen(const char *str
)
64 for (i
= 0; *str
; i
++) {
70 static inline int isdigit(int c
)
72 return (c
>= '0') && (c
<= '9');
75 uint64_t atoui(const char *str
);
76 char *uitoa(uint64_t num
, char *str
, size_t len
);