24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# undef __USE_XOPEN
#endif
#include <unistd.h>
#include "platform.h"
#ifdef OF_MAC_OS_X
# include <sys/sysctl.h>
#endif
#import "OFSystemInfo.h"
#import "OFString.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFApplication.h"
#import "OFNotImplementedException.h"
#if defined(OF_MAC_OS_X) || defined(OF_IOS)
# ifdef HAVE_SYSDIR_H
# include <sysdir.h>
# else
# include <NSSystemDirectories.h>
# endif
#endif
#ifdef OF_WINDOWS
|
|
|
|
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# undef __USE_XOPEN
#endif
#include <unistd.h>
#include "platform.h"
#ifdef OF_MACOS
# include <sys/sysctl.h>
#endif
#import "OFSystemInfo.h"
#import "OFString.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFApplication.h"
#import "OFNotImplementedException.h"
#if defined(OF_MACOS) || defined(OF_IOS)
# ifdef HAVE_SYSDIR_H
# include <sysdir.h>
# else
# include <NSSystemDirectories.h>
# endif
#endif
#ifdef OF_WINDOWS
|
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
+ (size_t)numberOfCPUs
{
return numberOfCPUs;
}
+ (OFString*)userDataPath
{
#if defined(OF_MAC_OS_X) || defined(OF_IOS)
void *pool = objc_autoreleasePoolPush();
char pathC[PATH_MAX];
OFMutableString *path;
OFString *home;
# ifdef HAVE_SYSDIR_START_SEARCH_PATH_ENUMERATION
sysdir_search_path_enumeration_state state;
|
|
|
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
+ (size_t)numberOfCPUs
{
return numberOfCPUs;
}
+ (OFString*)userDataPath
{
#if defined(OF_MACOS) || defined(OF_IOS)
void *pool = objc_autoreleasePoolPush();
char pathC[PATH_MAX];
OFMutableString *path;
OFString *home;
# ifdef HAVE_SYSDIR_START_SEARCH_PATH_ENUMERATION
sysdir_search_path_enumeration_state state;
|
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
objc_autoreleasePoolPop(pool);
return [var autorelease];
#endif
}
+ (OFString*)userConfigPath
{
#if defined(OF_MAC_OS_X) || defined(OF_IOS)
void *pool = objc_autoreleasePoolPush();
char pathC[PATH_MAX];
OFMutableString *path;
OFString *home;
# ifdef HAVE_SYSDIR_START_SEARCH_PATH_ENUMERATION
sysdir_search_path_enumeration_state state;
|
|
|
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
objc_autoreleasePoolPop(pool);
return [var autorelease];
#endif
}
+ (OFString*)userConfigPath
{
#if defined(OF_MACOS) || defined(OF_IOS)
void *pool = objc_autoreleasePoolPush();
char pathC[PATH_MAX];
OFMutableString *path;
OFString *home;
# ifdef HAVE_SYSDIR_START_SEARCH_PATH_ENUMERATION
sysdir_search_path_enumeration_state state;
|
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
|
return x86_cpuid(0, 0).eax >= 7 && (x86_cpuid(7, 0).ebx & (1 << 5));
}
#endif
#if defined(OF_POWERPC) || defined(OF_POWERPC64)
+ (bool)supportsAltiVec
{
# ifdef OF_MAC_OS_X
int name[2] = { CTL_HW, HW_VECTORUNIT }, value = 0;
size_t length = sizeof(value);
if (sysctl(name, 2, &value, &length, NULL, 0) == 0)
return value;
# endif
return 0;
}
#endif
@end
|
|
|
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
|
return x86_cpuid(0, 0).eax >= 7 && (x86_cpuid(7, 0).ebx & (1 << 5));
}
#endif
#if defined(OF_POWERPC) || defined(OF_POWERPC64)
+ (bool)supportsAltiVec
{
# ifdef OF_MACOS
int name[2] = { CTL_HW, HW_VECTORUNIT }, value = 0;
size_t length = sizeof(value);
if (sysctl(name, 2, &value, &length, NULL, 0) == 0)
return value;
# endif
return 0;
}
#endif
@end
|