Revert #undefining system functions, it is not necessary.
[mplayer/glamo.git] / libass / ass_utils.h
blobd7501c485d3b8e2af3e4b91171dce1be7014fe41
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 base, int* res);
29 int mystrtou32(char** p, int base, uint32_t* res);
30 int mystrtod(char** p, double* res);
31 int strtocolor(char** q, uint32_t* res);
33 static inline int d6_to_int(int x) {
34 return (x + 32) >> 6;
36 static inline int d16_to_int(int x) {
37 return (x + 32768) >> 16;
39 static inline int int_to_d6(int x) {
40 return x << 6;
42 static inline int int_to_d16(int x) {
43 return x << 16;
45 static inline int d16_to_d6(int x) {
46 return (x + 512) >> 10;
48 static inline int d6_to_d16(int x) {
49 return x << 10;
51 static inline double d6_to_double(int x) {
52 return x / 64.;
54 static inline int double_to_d6(double x) {
55 return (int)(x * 64);
57 static inline double d16_to_double(int x) {
58 return ((double)x) / 0x10000;
60 static inline int double_to_d16(double x) {
61 return (int)(x * 0x10000);
64 #endif /* LIBASS_UTILS_H */