Get rid of pointless preprocessor condition indirection and use ARCH_X86
[mplayer/glamo.git] / libass / ass_utils.h
blob8c5f3e8f49a1cee3f446c050b415cee4a9a36f9e
1 // -*- c-basic-offset: 8; indent-tabs-mode: t -*-
2 // vim:ts=8:sw=8:noet:ai:
3 /*
4 * Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
6 * This file is part of libass.
8 * libass is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * libass is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with libass; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #ifndef LIBASS_UTILS_H
24 #define LIBASS_UTILS_H
26 #include <stdint.h>
28 int mystrtoi(char** p, int* res);
29 int mystrtoll(char** p, long long* res);
30 int mystrtou32(char** p, int base, uint32_t* res);
31 int mystrtod(char** p, double* res);
32 int strtocolor(char** q, uint32_t* res);
33 char parse_bool(char* str);
35 static inline int d6_to_int(int x) {
36 return (x + 32) >> 6;
38 static inline int d16_to_int(int x) {
39 return (x + 32768) >> 16;
41 static inline int int_to_d6(int x) {
42 return x << 6;
44 static inline int int_to_d16(int x) {
45 return x << 16;
47 static inline int d16_to_d6(int x) {
48 return (x + 512) >> 10;
50 static inline int d6_to_d16(int x) {
51 return x << 10;
53 static inline double d6_to_double(int x) {
54 return x / 64.;
56 static inline int double_to_d6(double x) {
57 return (int)(x * 64);
59 static inline double d16_to_double(int x) {
60 return ((double)x) / 0x10000;
62 static inline int double_to_d16(double x) {
63 return (int)(x * 0x10000);
66 #endif /* LIBASS_UTILS_H */