2 * Copyright (C) 2010 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef _LIBSPARSE_SPARSE_DEFS_
18 #define _LIBSPARSE_SPARSE_DEFS_
36 typedef unsigned long long u64
;
37 typedef signed long long s64
;
38 typedef unsigned int u32
;
39 typedef unsigned short int u16
;
40 typedef unsigned char u8
;
42 #define DIV_ROUND_UP(x, y) (((x) + (y) - 1)/(y))
43 #define ALIGN(x, y) ((y) * DIV_ROUND_UP((x), (y)))
44 #define ALIGN_DOWN(x, y) ((y) * ((x) / (y)))
46 #define error(fmt, args...) do { fprintf(stderr, "error: %s: " fmt "\n", __func__, ## args); } while (0)
47 #define error_errno(s, args...) error(s ": %s", ##args, strerror(errno))