ObjFW  Check-in [1f9070d204]

Overview
Comment:Add support for AltiVec detection on MorphOS
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1f9070d2046158ccf7b832788e3b5ef17077ff5c87e88de390e5b7e1dba0953b
User & Date: js on 2017-06-12 20:39:54
Other Links: manifest | tags
Context
2017-06-12
22:29
OFWriteFailedException: Add -[bytesWritten] check-in: 2ae01218ef user: js tags: trunk
20:39
Add support for AltiVec detection on MorphOS check-in: 1f9070d204 user: js tags: trunk
2017-06-11
23:28
objfw-config: Add -lobjfw-rt to --libs check-in: 032cace081 user: js tags: trunk
Changes

Modified src/OFSystemInfo.m from [163a46eba3] to [254f78a8f6].

23
24
25
26
27
28
29







30
31
32
33
34
35
36
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43







+
+
+
+
+
+
+







#include "unistd_wrapper.h"

#include "platform.h"

#ifdef OF_MACOS
# include <sys/sysctl.h>
#endif

#ifdef OF_MORPHOS
# define BOOL EXEC_BOOL
# include <exec/system.h>
# include <proto/exec.h>
# undef BOOL
#endif

#import "OFSystemInfo.h"
#import "OFString.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFApplication.h"

366
367
368
369
370
371
372
373

374
375
376
377
378








379
380
381
382
383
384
373
374
375
376
377
378
379

380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399







-
+





+
+
+
+
+
+
+
+






	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
# if defined(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;
# elif defined(OF_MORPHOS)
	uint32_t supportsAltiVec;

	if (NewGetSystemAttrs(&supportsAltiVec, sizeof(supportsAltiVec),
	    SYSTEMINFOTYPE_PPC_ALTIVEC, TAG_DONE) > 0)
		return supportsAltiVec;

	return false;
# endif

	return false;
}
#endif
@end