]>
git.saurik.com Git - cydia.git/blob - CyteKit/UCPlatform.h
1 /* Cydia - iPhone UIKit Front-End for Debian APT
2 * Copyright (C) 2008-2013 Jay Freeman (saurik)
5 /* GNU General Public License, Version 3 {{{ */
7 * Cydia is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published
9 * by the Free Software Foundation, either version 3 of the License,
10 * or (at your option) any later version.
12 * Cydia is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Cydia. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef CyteKit_UCPlatform_H
23 #define CyteKit_UCPlatform_H
25 #define __STDC_LIMIT_MACROS
28 #include <objc/objc.h>
36 extern struct timeval _ltv
;
39 #define _trace() do { \
40 struct timeval _ctv; \
41 gettimeofday(&_ctv, NULL); \
46 fprintf(stderr, "%lu.%.6u[%f]:_trace()@%s:%u[%s]\n", \
47 _ctv.tv_sec, _ctv.tv_usec, \
48 (_ctv.tv_sec - _ltv.tv_sec) + (_ctv.tv_usec - _ltv.tv_usec) / 1000000.0, \
49 __FILE__, __LINE__, __FUNCTION__\
54 #define _assert(test) do \
56 fprintf(stderr, "_assert(%d:%s)@%s:%u[%s]\n", errno, #test, __FILE__, __LINE__, __FUNCTION__); \
61 #define _not(type) ((type) ~ (type) 0)
65 #define _label__(x) _label ## x
66 #define _label_(y) _label__(y)
67 #define _label _label_(__LINE__)
70 __attribute__((__packed__))
72 inline __attribute__((__always_inline__))
82 #define _likely(expr) \
83 __builtin_expect(expr, 1)
85 #define _unlikely(expr) \
86 __builtin_expect(expr, 0)
88 #endif//CyteKit_UCPlatform_H