1 // -*- c-basic-offset: 8; indent-tabs-mode: t -*-
2 // vim:ts=8:sw=8:noet:ai:
4 Copyright (C) 2006 Evgeniy Stepanov <eugeni.stepanov@gmail.com>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 int mystrtoi(char** p
, int base
, int* res
);
25 int mystrtou32(char** p
, int base
, uint32_t* res
);
26 int mystrtod(char** p
, double* res
);
27 int strtocolor(char** q
, uint32_t* res
);
29 static inline int d6_to_int(int x
) {
32 static inline int d16_to_int(int x
) {
33 return (x
+ 32768) >> 16;
35 static inline int int_to_d6(int x
) {
38 static inline int int_to_d16(int x
) {
41 static inline int d16_to_d6(int x
) {
42 return (x
+ 512) >> 10;
44 static inline int d6_to_d16(int x
) {
47 static inline double d6_to_double(int x
) {
50 static inline int double_to_d6(double x
) {
53 static inline double d16_to_double(int x
) {
54 return ((double)x
) / 0x10000;
56 static inline int double_to_d16(double x
) {
57 return (int)(x
* 0x10000);
60 #endif /* ASS_UTILS_H */