summaryrefslogtreecommitdiffstats
path: root/UnknownVersion/include/EABase/config/eaplatform.h
blob: ea3dbadf8906dfa076a212a397b7ee297cbec156 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
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
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
/*-----------------------------------------------------------------------------
 * config/eaplatform.h
 *
 * Copyright (c) Electronic Arts Inc. All rights reserved.
 *-----------------------------------------------------------------------------
 * Currently supported platform indentification defines include:
 */
#ifdef EA_PLATFORM_PS4 // ifdef for code stripping purposes
// EA_PLATFORM_PS4 (EA_PLATFORM_KETTLE)
#endif
#ifdef EA_PLATFORM_XBOXONE // ifdef for code stripping purposes
// EA_PLATFORM_XBOXONE (EA_PLATFORM_CAPILANO)
// EA_PLATFORM_XBOXONE_XDK (EA_PLATFORM_CAPILANO_XDK), set by capilano_config package
// EA_PLATFORM_XBOXONE_ADK (EA_PLATFORM_CAPILANO_ADK), set by capilano_config package
#endif
//    EA_PLATFORM_ANDROID
//    EA_PLATFORM_APPLE
//    EA_PLATFORM_IPHONE
//    EA_PLATFORM_IPHONE_SIMULATOR
//    EA_PLATFORM_OSX
//    EA_PLATFORM_LINUX
//    EA_PLATFORM_SAMSUNG_TV
//    EA_PLATFORM_WINDOWS
//    EA_PLATFORM_WIN32
//    EA_PLATFORM_WIN64
//    EA_PLATFORM_WINDOWS_PHONE
//    EA_PLATFORM_WINRT
//    EA_PLATFORM_SUN
//    EA_PLATFORM_LRB (Larrabee)
//    EA_PLATFORM_POSIX     (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX, EA_PLATFORM_UNIX, EA_PLATFORM_QNX)
//    EA_PLATFORM_UNIX      (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX)
//    EA_PLATFORM_CYGWIN    (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX)
//    EA_PLATFORM_MINGW     (pseudo-platform; may be defined along with another platform like EA_PLATFORM_WINDOWS)
//    EA_PLATFORM_MICROSOFT (pseudo-platform; may be defined along with another platform like EA_PLATFORM_WINDOWS)
//
//    EA_ABI_ARM_LINUX      (a.k.a. "eabi". for all platforms that use the CodeSourcery GNU/Linux toolchain, like Android)
//    EA_ABI_ARM_APPLE      (similar to eabi but not identical)
//    EA_ABI_ARM64_APPLE    (similar to eabi but not identical) https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html
//    EA_ABI_ARM_WINCE      (similar to eabi but not identical)
//
// Other definitions emanated from this file inclue:
//    EA_PLATFORM_NAME = <string>
//    EA_PLATFORM_DESCRIPTION = <string>
//    EA_PROCESSOR_XXX
//    EA_MISALIGNED_SUPPORT_LEVEL=0|1|2
//    EA_SYSTEM_LITTLE_ENDIAN | EA_SYSTEM_BIG_ENDIAN
//    EA_ASM_STYLE_ATT | EA_ASM_STYLE_INTEL | EA_ASM_STYLE_MOTOROLA
//    EA_PLATFORM_PTR_SIZE = <integer size in bytes>
//    EA_PLATFORM_WORD_SIZE = <integer size in bytes>
//    EA_CACHE_LINE_SIZE = <integer size in bytes>
//---------------------------------------------------------------------------

/*
        EA_PLATFORM_MOBILE
        EA_PLATFORM_MOBILE is a peer to EA_PLATORM_DESKTOP and EA_PLATFORM_CONSOLE. Their definition is qualitative rather
        than quantitative, and refers to the general (usually weaker) capabilities of the machine. Mobile devices have a
        similar set of weaknesses that are useful to generally categorize. The primary motivation is to avoid code that
        tests for multiple mobile platforms on a line and needs to be updated every time we get a new one.
        For example, mobile platforms tend to have weaker ARM processors, don't have full multiple processor support,
        are hand-held, don't have mice (though may have touch screens or basic cursor controls), have writable solid
        state permanent storage. Production user code shouldn't have too many expectations about the meaning of this define.

        EA_PLATFORM_DESKTOP
        This is similar to EA_PLATFORM_MOBILE in its qualitative nature and refers to platforms that are powerful.
        For example, they nearly always have virtual memory, mapped memory, hundreds of GB of writable disk storage,
        TCP/IP network connections, mice, keyboards, 512+ MB of RAM, multiprocessing, multiple display support.
        Production user code shouldn't have too many expectations about the meaning of this define.

        EA_PLATFORM_CONSOLE
        This is similar to EA_PLATFORM_MOBILE in its qualitative nature and refers to platforms that are consoles.
        This means platforms that are connected to TVs, are fairly powerful (especially graphics-wise), are tightly
        controlled by vendors, tend not to have mapped memory, tend to have TCP/IP, don't have multiple process support
        though they might have multiple CPUs, support TV output only. Production user code shouldn't have too many
        expectations about the meaning of this define.

*/


#ifndef INCLUDED_eaplatform_H
#define INCLUDED_eaplatform_H


// Cygwin
// This is a pseudo-platform which will be defined along with EA_PLATFORM_LINUX when
// using the Cygwin build environment.
#if defined(__CYGWIN__)
#define EA_PLATFORM_CYGWIN 1
#define EA_PLATFORM_DESKTOP 1
#endif

// MinGW
// This is a pseudo-platform which will be defined along with EA_PLATFORM_WINDOWS when
// using the MinGW Windows build environment.
#if defined(__MINGW32__) || defined(__MINGW64__)
#define EA_PLATFORM_MINGW 1
#define EA_PLATFORM_DESKTOP 1
#endif

#if defined(EA_PLATFORM_PS4) || defined(__ORBIS__) || defined(EA_PLATFORM_KETTLE)
// PlayStation 4
// Orbis was Sony's code-name for the platform, which is now obsolete.
// Kettle was an EA-specific code-name for the platform, which is now obsolete.
#if defined(EA_PLATFORM_PS4)
#undef  EA_PLATFORM_PS4
#endif
#define EA_PLATFORM_PS4 1

// Backward compatibility:
#if defined(EA_PLATFORM_KETTLE)
#undef  EA_PLATFORM_KETTLE
#endif
// End backward compatbility

#define EA_PLATFORM_KETTLE 1
#define EA_PLATFORM_NAME "PS4"
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "PS4 on x64"
#define EA_PLATFORM_CONSOLE 1
#define EA_PLATFORM_SONY 1
#define EA_PLATFORM_POSIX 1
// #define EA_POSIX_THREADS_AVAILABLE 1  // POSIX threading API is available but discouraged.  Sony indicated use of the scePthreads* API is preferred.
#define EA_PROCESSOR_X86_64 1
#if defined(__GNUC__) || defined(__clang__)
#define EA_ASM_STYLE_ATT 1
#endif

#elif defined(EA_PLATFORM_XBOXONE) || defined(_DURANGO) || defined(_XBOX_ONE) || defined(EA_PLATFORM_CAPILANO) || defined(_GAMING_XBOX)
// XBox One
// Durango was Microsoft's code-name for the platform, which is now obsolete.
// Microsoft uses _DURANGO instead of some variation of _XBOX, though it's not natively defined by the compiler.
// Capilano was an EA-specific code-name for the platform, which is now obsolete.
#if defined(EA_PLATFORM_XBOXONE)
#undef  EA_PLATFORM_XBOXONE
#endif
#define EA_PLATFORM_XBOXONE 1

// Backward compatibility:
#if defined(EA_PLATFORM_CAPILANO)
#undef  EA_PLATFORM_CAPILANO
#endif
#define EA_PLATFORM_CAPILANO 1
#if defined(EA_PLATFORM_CAPILANO_XDK) && !defined(EA_PLATFORM_XBOXONE_XDK)
#define EA_PLATFORM_XBOXONE_XDK 1
#endif
#if defined(EA_PLATFORM_CAPILANO_ADK) && !defined(EA_PLATFORM_XBOXONE_ADK)
#define EA_PLATFORM_XBOXONE_ADK 1
#endif
// End backward compatibility

#if !defined(_DURANGO)
#define _DURANGO
#endif
#define EA_PLATFORM_NAME "XBox One"
//#define EA_PROCESSOR_X86  Currently our policy is that we don't define this, even though x64 is something of a superset of x86.
#define EA_PROCESSOR_X86_64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "XBox One on x64"
#define EA_ASM_STYLE_INTEL 1
#define EA_PLATFORM_CONSOLE 1
#define EA_PLATFORM_MICROSOFT 1

// WINAPI_FAMILY defines - mirrored from winapifamily.h
#define EA_WINAPI_FAMILY_APP         1000
#define EA_WINAPI_FAMILY_DESKTOP_APP 1001
#define EA_WINAPI_FAMILY_PHONE_APP   1002
#define EA_WINAPI_FAMILY_TV_APP      1003
#define EA_WINAPI_FAMILY_TV_TITLE    1004
#define EA_WINAPI_FAMILY_GAMES       1006

#if defined(WINAPI_FAMILY)
#include <winapifamily.h>
#if defined(WINAPI_FAMILY_TV_TITLE) && WINAPI_FAMILY == WINAPI_FAMILY_TV_TITLE
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_TV_TITLE
#elif defined(WINAPI_FAMILY_DESKTOP_APP) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP
#elif defined(WINAPI_FAMILY_GAMES) && WINAPI_FAMILY == WINAPI_FAMILY_GAMES
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_GAMES
#else
#error Unsupported WINAPI_FAMILY
#endif
#else
#error WINAPI_FAMILY should always be defined on Capilano.
#endif

// Macro to determine if a partition is enabled.
#define EA_WINAPI_FAMILY_PARTITION(Partition)	(Partition)

#if EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_DESKTOP_APP
#define EA_WINAPI_PARTITION_CORE     1
#define EA_WINAPI_PARTITION_DESKTOP  1
#define EA_WINAPI_PARTITION_APP      1
#define EA_WINAPI_PARTITION_PC_APP   0
#define EA_WIANPI_PARTITION_PHONE    0
#define EA_WINAPI_PARTITION_TV_APP   0
#define EA_WINAPI_PARTITION_TV_TITLE 0
#define EA_WINAPI_PARTITION_GAMES    0
#elif EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_TV_TITLE
#define EA_WINAPI_PARTITION_CORE     1
#define EA_WINAPI_PARTITION_DESKTOP  0
#define EA_WINAPI_PARTITION_APP      0
#define EA_WINAPI_PARTITION_PC_APP   0
#define EA_WIANPI_PARTITION_PHONE    0
#define EA_WINAPI_PARTITION_TV_APP   0
#define EA_WINAPI_PARTITION_TV_TITLE 1
#define EA_WINAPI_PARTITION_GAMES    0
#elif EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_GAMES
#define EA_WINAPI_PARTITION_CORE     1
#define EA_WINAPI_PARTITION_DESKTOP  0
#define EA_WINAPI_PARTITION_APP      0
#define EA_WINAPI_PARTITION_PC_APP   0
#define EA_WIANPI_PARTITION_PHONE    0
#define EA_WINAPI_PARTITION_TV_APP   0
#define EA_WINAPI_PARTITION_TV_TITLE 0
#define EA_WINAPI_PARTITION_GAMES    1
#else
#error Unsupported WINAPI_FAMILY
#endif

#if EA_WINAPI_FAMILY_PARTITION(EA_WINAPI_PARTITION_GAMES)
#define CS_UNDEFINED_STRING 			1
#define CS_UNDEFINED_STRING 		1
#endif

#if EA_WINAPI_FAMILY_PARTITION(EA_WINAPI_PARTITION_TV_TITLE)
#define EA_PLATFORM_XBOXONE_XDK 	1
#endif
#elif defined(EA_PLATFORM_LRB) || defined(__LRB__) || (defined(__EDG__) && defined(__ICC) && defined(__x86_64__))
#undef  EA_PLATFORM_LRB
#define EA_PLATFORM_LRB         1
#define EA_PLATFORM_NAME        "Larrabee"
#define EA_PLATFORM_DESCRIPTION "Larrabee on LRB1"
#define EA_PROCESSOR_X86_64 1
#if defined(BYTE_ORDER) && (BYTE_ORDER == 4321)
#define EA_SYSTEM_BIG_ENDIAN 1
#else
#define EA_SYSTEM_LITTLE_ENDIAN 1
#endif
#define EA_PROCESSOR_LRB 1
#define EA_PROCESSOR_LRB1 1       // Larrabee version 1
#define EA_ASM_STYLE_ATT 1        // Both types of asm style
#define EA_ASM_STYLE_INTEL 1      // are supported.
#define EA_PLATFORM_DESKTOP 1

// Android (Google phone OS)
#elif defined(EA_PLATFORM_ANDROID) || defined(__ANDROID__)
#undef  EA_PLATFORM_ANDROID
#define EA_PLATFORM_ANDROID 1
#define EA_PLATFORM_LINUX 1
#define EA_PLATFORM_UNIX 1
#define EA_PLATFORM_POSIX 1
#define EA_PLATFORM_NAME "Android"
#define EA_ASM_STYLE_ATT 1
#if defined(__arm__)
#define EA_ABI_ARM_LINUX 1  // a.k.a. "ARM eabi"
#define EA_PROCESSOR_ARM32 1
#define EA_PLATFORM_DESCRIPTION "Android on ARM"
#elif defined(__aarch64__)
#define EA_PROCESSOR_ARM64 1
#define EA_PLATFORM_DESCRIPTION "Android on ARM64"
#elif defined(__i386__)
#define EA_PROCESSOR_X86 1
#define EA_PLATFORM_DESCRIPTION "Android on x86"
#elif defined(__x86_64)
#define EA_PROCESSOR_X86_64 1
#define EA_PLATFORM_DESCRIPTION "Android on x64"
#else
#error Unknown processor
#endif
#if !defined(EA_SYSTEM_BIG_ENDIAN) && !defined(EA_SYSTEM_LITTLE_ENDIAN)
#define EA_SYSTEM_LITTLE_ENDIAN 1
#endif
#define EA_PLATFORM_MOBILE 1

// Samsung SMART TV - a Linux-based smart TV
#elif defined(EA_PLATFORM_SAMSUNG_TV)
#undef  EA_PLATFORM_SAMSUNG_TV
#define EA_PLATFORM_SAMSUNG_TV 1
#define EA_PLATFORM_LINUX 1
#define EA_PLATFORM_UNIX 1
#define EA_PLATFORM_POSIX 1
#define EA_PLATFORM_NAME "SamsungTV"
#define EA_PLATFORM_DESCRIPTION "Samsung SMART TV on ARM"
#define EA_ASM_STYLE_ATT 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PROCESSOR_ARM32 1
#define EA_ABI_ARM_LINUX 1 // a.k.a. "ARM eabi"
#define EA_PROCESSOR_ARM7 1

#elif defined(__APPLE__) && __APPLE__
#include <TargetConditionals.h>

// Apple family of operating systems.
#define EA_PLATFORM_APPLE
#define EA_PLATFORM_POSIX 1

// iPhone
// TARGET_OS_IPHONE will be undefined on an unknown compiler, and will be defined on gcc.
#if defined(EA_PLATFORM_IPHONE) || defined(__IPHONE__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)
#undef  EA_PLATFORM_IPHONE
#define EA_PLATFORM_IPHONE 1
#define EA_PLATFORM_NAME "iPhone"
#define EA_ASM_STYLE_ATT 1
#define EA_POSIX_THREADS_AVAILABLE 1
#if defined(__arm__)
#define EA_ABI_ARM_APPLE 1
#define EA_PROCESSOR_ARM32 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "iPhone on ARM"
#elif defined(__aarch64__) || defined(__AARCH64)
#define EA_ABI_ARM64_APPLE 1
#define EA_PROCESSOR_ARM64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "iPhone on ARM64"
#elif defined(__i386__)
#define EA_PLATFORM_IPHONE_SIMULATOR 1
#define EA_PROCESSOR_X86 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "iPhone simulator on x86"
#elif defined(__x86_64) || defined(__amd64)
#define EA_PROCESSOR_X86_64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "iPhone simulator on x64"
#else
#error Unknown processor
#endif
#define EA_PLATFORM_MOBILE 1

// Macintosh OSX
// TARGET_OS_MAC is defined by the Metrowerks and older AppleC compilers.
// Howerver, TARGET_OS_MAC is defined to be 1 in all cases.
// __i386__ and __intel__ are defined by the GCC compiler.
// __dest_os is defined by the Metrowerks compiler.
// __MACH__ is defined by the Metrowerks and GCC compilers.
// powerc and __powerc are defined by the Metrowerks and GCC compilers.
#elif defined(EA_PLATFORM_OSX) || defined(__MACH__) || (defined(__MSL__) && (__dest_os == __mac_os_x))
#undef  EA_PLATFORM_OSX
#define EA_PLATFORM_OSX 1
#define EA_PLATFORM_UNIX 1
#define EA_PLATFORM_POSIX 1
//#define EA_PLATFORM_BSD 1           We don't currently define this. OSX has some BSD history but a lot of the API is different.
#define EA_PLATFORM_NAME "OSX"
#if defined(__i386__) || defined(__intel__)
#define EA_PROCESSOR_X86 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "OSX on x86"
#elif defined(__x86_64) || defined(__amd64)
#define EA_PROCESSOR_X86_64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "OSX on x64"
#elif defined(__arm__)
#define EA_ABI_ARM_APPLE 1
#define EA_PROCESSOR_ARM32 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "OSX on ARM"
#elif defined(__aarch64__) || defined(__AARCH64)
#define EA_ABI_ARM64_APPLE 1
#define EA_PROCESSOR_ARM64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "OSX on ARM64"
#elif defined(__POWERPC64__) || defined(__powerpc64__)
#define EA_PROCESSOR_POWERPC 1
#define EA_PROCESSOR_POWERPC_64 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "OSX on PowerPC 64"
#elif defined(__POWERPC__) || defined(__powerpc__)
#define EA_PROCESSOR_POWERPC 1
#define EA_PROCESSOR_POWERPC_32 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "OSX on PowerPC"
#else
#error Unknown processor
#endif
#if defined(__GNUC__)
#define EA_ASM_STYLE_ATT 1
#else
#define EA_ASM_STYLE_MOTOROLA 1
#endif
#define EA_PLATFORM_DESKTOP 1
#else
#error Unknown Apple Platform
#endif

// Linux
// __linux and __linux__ are defined by the GCC and Borland compiler.
// __i386__ and __intel__ are defined by the GCC compiler.
// __i386__ is defined by the Metrowerks compiler.
// _M_IX86 is defined by the Borland compiler.
// __sparc__ is defined by the GCC compiler.
// __powerpc__ is defined by the GCC compiler.
// __ARM_EABI__ is defined by GCC on an ARM v6l (Raspberry Pi 1)
// __ARM_ARCH_7A__ is defined by GCC on an ARM v7l (Raspberry Pi 2)
#elif defined(EA_PLATFORM_LINUX) || (defined(__linux) || defined(__linux__))
#undef  EA_PLATFORM_LINUX
#define EA_PLATFORM_LINUX 1
#define EA_PLATFORM_UNIX 1
#define EA_PLATFORM_POSIX 1
#define EA_PLATFORM_NAME "Linux"
#if defined(__i386__) || defined(__intel__) || defined(_M_IX86)
#define EA_PROCESSOR_X86 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Linux on x86"
#elif defined(__ARM_ARCH_7A__) || defined(__ARM_EABI__)
#define EA_ABI_ARM_LINUX 1
#define EA_PROCESSOR_ARM32 1
#define EA_PLATFORM_DESCRIPTION "Linux on ARM 6/7 32-bits"
#elif defined(__aarch64__) || defined(__AARCH64)
#define EA_PROCESSOR_ARM64 1
#define EA_PLATFORM_DESCRIPTION "Linux on ARM64"
#elif defined(__x86_64__)
#define EA_PROCESSOR_X86_64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Linux on x64"
#elif defined(__powerpc64__)
#define EA_PROCESSOR_POWERPC 1
#define EA_PROCESSOR_POWERPC_64 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Linux on PowerPC 64"
#elif defined(__powerpc__)
#define EA_PROCESSOR_POWERPC 1
#define EA_PROCESSOR_POWERPC_32 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Linux on PowerPC"
#else
#error Unknown processor
#error Unknown endianness
#endif
#if defined(__GNUC__)
#define EA_ASM_STYLE_ATT 1
#endif
#define EA_PLATFORM_DESKTOP 1


#elif defined(EA_PLATFORM_BSD) || (defined(__BSD__) || defined(__FreeBSD__))
#undef  EA_PLATFORM_BSD
#define EA_PLATFORM_BSD 1
#define EA_PLATFORM_UNIX 1
#define EA_PLATFORM_POSIX 1     // BSD's posix complaince is not identical to Linux's
#define EA_PLATFORM_NAME "BSD Unix"
#if defined(__i386__) || defined(__intel__)
#define EA_PROCESSOR_X86 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "BSD on x86"
#elif defined(__x86_64__)
#define EA_PROCESSOR_X86_64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "BSD on x64"
#elif defined(__powerpc64__)
#define EA_PROCESSOR_POWERPC 1
#define EA_PROCESSOR_POWERPC_64 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "BSD on PowerPC 64"
#elif defined(__powerpc__)
#define EA_PROCESSOR_POWERPC 1
#define EA_PROCESSOR_POWERPC_32 1
#define EA_SYSTEM_BIG_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "BSD on PowerPC"
#else
#error Unknown processor
#error Unknown endianness
#endif
#if !defined(EA_PLATFORM_FREEBSD) && defined(__FreeBSD__)
#define EA_PLATFORM_FREEBSD 1 // This is a variation of BSD.
#endif
#if defined(__GNUC__)
#define EA_ASM_STYLE_ATT 1
#endif
#define EA_PLATFORM_DESKTOP 1


#elif defined(EA_PLATFORM_WINDOWS_PHONE)
#undef EA_PLATFORM_WINDOWS_PHONE
#define EA_PLATFORM_WINDOWS_PHONE 1
#define EA_PLATFORM_NAME "Windows Phone"
#if defined(_M_AMD64) || defined(_AMD64_) || defined(__x86_64__)
#define EA_PROCESSOR_X86_64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows Phone on x64"
#elif defined(_M_IX86) || defined(_X86_)
#define EA_PROCESSOR_X86 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows Phone on X86"
#elif defined(_M_ARM)
#define EA_ABI_ARM_WINCE 1
#define EA_PROCESSOR_ARM32 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows Phone on ARM"
#else //Possibly other Windows Phone variants
#error Unknown processor
#error Unknown endianness
#endif
#define EA_PLATFORM_MICROSOFT 1

// WINAPI_FAMILY defines - mirrored from winapifamily.h
#define EA_WINAPI_FAMILY_APP         1
#define EA_WINAPI_FAMILY_DESKTOP_APP 2
#define EA_WINAPI_FAMILY_PHONE_APP   3

#if defined(WINAPI_FAMILY)
#include <winapifamily.h>
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_PHONE_APP
#else
#error Unsupported WINAPI_FAMILY for Windows Phone
#endif
#else
#error WINAPI_FAMILY should always be defined on Windows Phone.
#endif

// Macro to determine if a partition is enabled.
#define EA_WINAPI_FAMILY_PARTITION(Partition)   (Partition)

// Enable the appropriate partitions for the current family
#if EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_PHONE_APP
#   define EA_WINAPI_PARTITION_CORE    1
#   define EA_WINAPI_PARTITION_PHONE   1
#   define EA_WINAPI_PARTITION_APP     1
#else
#   error Unsupported WINAPI_FAMILY for Windows Phone
#endif


// Windows
// _WIN32 is defined by the VC++, Intel and GCC compilers.
// _WIN64 is defined by the VC++, Intel and GCC compilers.
// __WIN32__ is defined by the Borland compiler.
// __INTEL__ is defined by the Metrowerks compiler.
// _M_IX86, _M_AMD64 and _M_IA64 are defined by the VC++, Intel, and Borland compilers.
// _X86_, _AMD64_, and _IA64_ are defined by the Metrowerks compiler.
// _M_ARM is defined by the VC++ compiler.
#elif (defined(EA_PLATFORM_WINDOWS) || (defined(_WIN32) || defined(__WIN32__) || defined(_WIN64))) && !defined(CS_UNDEFINED_STRING)
#undef  EA_PLATFORM_WINDOWS
#define EA_PLATFORM_WINDOWS 1
#define EA_PLATFORM_NAME "Windows"
#ifdef _WIN64 // VC++ defines both _WIN32 and _WIN64 when compiling for Win64.
#define EA_PLATFORM_WIN64 1
#else
#define EA_PLATFORM_WIN32 1
#endif
#if defined(_M_AMD64) || defined(_AMD64_) || defined(__x86_64__)
#define EA_PROCESSOR_X86_64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows on x64"
#elif defined(_M_IX86) || defined(_X86_)
#define EA_PROCESSOR_X86 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows on X86"
#elif defined(_M_IA64) || defined(_IA64_)
#define EA_PROCESSOR_IA64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows on IA-64"
#elif defined(_M_ARM)
#define EA_ABI_ARM_WINCE 1
#define EA_PROCESSOR_ARM32 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows on ARM"
#elif defined(_M_ARM64)
#define EA_PROCESSOR_ARM64 1
#define EA_SYSTEM_LITTLE_ENDIAN 1
#define EA_PLATFORM_DESCRIPTION "Windows on ARM64"
#else //Possibly other Windows CE variants
#error Unknown processor
#error Unknown endianness
#endif
#if defined(__GNUC__)
#define EA_ASM_STYLE_ATT 1
#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__ICL)
#define EA_ASM_STYLE_INTEL 1
#endif
#define EA_PLATFORM_DESKTOP 1
#define EA_PLATFORM_MICROSOFT 1

// WINAPI_FAMILY defines to support Windows 8 Metro Apps - mirroring winapifamily.h in the Windows 8 SDK
#define EA_WINAPI_FAMILY_APP         1000
#define EA_WINAPI_FAMILY_DESKTOP_APP 1001
#define EA_WINAPI_FAMILY_GAMES       1006

#if defined(WINAPI_FAMILY)
#if defined(_MSC_VER)
#pragma warning(push, 0)
#endif
#include <winapifamily.h>
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
#if defined(WINAPI_FAMILY_DESKTOP_APP) && WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP
#elif defined(WINAPI_FAMILY_APP) && WINAPI_FAMILY == WINAPI_FAMILY_APP
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_APP
#elif defined(WINAPI_FAMILY_GAMES) && WINAPI_FAMILY == WINAPI_FAMILY_GAMES
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_GAMES
#else
#error Unsupported WINAPI_FAMILY
#endif
#else
#define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP
#endif

#define EA_WINAPI_PARTITION_DESKTOP   1
#define EA_WINAPI_PARTITION_APP       1
#define EA_WINAPI_PARTITION_GAMES    (EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_GAMES)

#define EA_WINAPI_FAMILY_PARTITION(Partition)   (Partition)

// EA_PLATFORM_WINRT
// This is a subset of Windows which is used for tablets and the "Metro" (restricted) Windows user interface.
// WinRT doesn't doesn't have access to the Windows "desktop" API, but WinRT can nevertheless run on
// desktop computers in addition to tablets. The Windows Phone API is a subset of WinRT and is not included
// in it due to it being only a part of the API.
#if defined(__cplusplus_winrt)
#define EA_PLATFORM_WINRT 1
#endif

#elif defined(__ghs__)
#undef  EA_PLATFORM_INTEGRITY
#define EA_PLATFORM_INTEGRITY 1
#undef  EA_PLATFORM_LINUX
#define EA_PLATFORM_LINUX 1
#define EA_PLATFORM_UNIX 1
#define EA_PLATFORM_NAME "INTEGRITY"
#define EA_PROCESSOR_ARM
#define EA_SYSTEM_LITTLE_ENDIAN
#define EA_PLATFORM_DESCRIPTION "INTEGRITY on ARM"
#define EA_PLATFORM_DESKTOP
#elif defined(__QNX__) || defined(__QNXNTO__)
#undef  EA_PLATFORM_QNX
#define EA_PLATFORM_QNX 1
#undef  EA_PLATFORM_LINUX
#define EA_PLATFORM_LINUX 1
#define EA_PLATFORM_UNIX 1
#define EA_PLATFORM_NAME "QNX"
#if defined(__i386__) || defined(__intel__) || defined(_M_IX86)
#define EA_PROCESSOR_X86
#define EA_SYSTEM_LITTLE_ENDIAN
#define EA_PLATFORM_DESCRIPTION "QNX on x86"
#elif defined(__x86_64__)
#define EA_PROCESSOR_X86_64
#define EA_SYSTEM_LITTLE_ENDIAN
#define EA_PLATFORM_DESCRIPTION "QNX on x86-64"
#elif defined(__powerpc64__)
#define EA_PROCESSOR_POWERPC
#define EA_PROCESSOR_POWERPC_64
#define EA_SYSTEM_BIG_ENDIAN
#define EA_PLATFORM_DESCRIPTION "QNX on PowerPC 64"
#elif defined(__powerpc__)
#define EA_PROCESSOR_POWERPC
#define EA_PROCESSOR_POWERPC_32
#define EA_SYSTEM_BIG_ENDIAN
#define EA_PLATFORM_DESCRIPTION "QNX on PowerPC"
#elif defined(__arm__) || defined(__aarch64__)
#define EA_PROCESSOR_ARM
#define EA_SYSTEM_LITTLE_ENDIAN
#define EA_PLATFORM_DESCRIPTION "QNX on ARM"
#error Unknown processor
#error Unknown endianness

// Sun (Solaris)
// __SUNPRO_CC is defined by the Sun compiler.
// __sun is defined by the GCC compiler.
// __i386 is defined by the Sun and GCC compilers.
// __sparc is defined by the Sun and GCC compilers.
#else
#error Unknown platform
#error Unknown processor
#error Unknown endianness
#endif

#ifndef EA_PROCESSOR_ARM
#if defined(EA_PROCESSOR_ARM32) || defined(EA_PROCESSOR_ARM64) || defined(EA_PROCESSOR_ARM7)
#define EA_PROCESSOR_ARM
#endif
#endif

// EA_PLATFORM_PTR_SIZE
// Platform pointer size; same as sizeof(void*).
// This is not the same as sizeof(int), as int is usually 32 bits on
// even 64 bit platforms.
//
// _WIN64 is defined by Win64 compilers, such as VC++.
// _M_IA64 is defined by VC++ and Intel compilers for IA64 processors.
// __LP64__ is defined by HP compilers for the LP64 standard.
// _LP64 is defined by the GCC and Sun compilers for the LP64 standard.
// __ia64__ is defined by the GCC compiler for IA64 processors.
// __arch64__ is defined by the Sparc compiler for 64 bit processors.
// __mips64__ is defined by the GCC compiler for MIPS processors.
// __powerpc64__ is defined by the GCC compiler for PowerPC processors.
// __64BIT__ is defined by the AIX compiler for 64 bit processors.
// __sizeof_ptr is defined by the ARM compiler (armcc, armcpp).
//
#ifndef EA_PLATFORM_PTR_SIZE
#if defined(__WORDSIZE) // Defined by some variations of GCC.
#define EA_PLATFORM_PTR_SIZE ((__WORDSIZE) / 8)
#elif defined(_WIN64) || defined(__LP64__) || defined(_LP64) || defined(_M_IA64) || defined(__ia64__) || defined(__arch64__) || defined(__aarch64__) || defined(__mips64__) || defined(__64BIT__) || defined(__Ptr_Is_64)
#define EA_PLATFORM_PTR_SIZE 8
#elif defined(__CC_ARM) && (__sizeof_ptr == 8)
#define EA_PLATFORM_PTR_SIZE 8
#else
#define EA_PLATFORM_PTR_SIZE 4
#endif
#endif



// EA_PLATFORM_WORD_SIZE
// This defines the size of a machine word. This will be the same as
// the size of registers on the machine but not necessarily the same
// as the size of pointers on the machine. A number of 64 bit platforms
// have 64 bit registers but 32 bit pointers.
//
#ifndef EA_PLATFORM_WORD_SIZE
#define EA_PLATFORM_WORD_SIZE EA_PLATFORM_PTR_SIZE
#endif

// EA_PLATFORM_MIN_MALLOC_ALIGNMENT
// This defines the minimal alignment that the platform's malloc
// implementation will return. This should be used when writing custom
// allocators to ensure that the alignment matches that of malloc
#ifndef EA_PLATFORM_MIN_MALLOC_ALIGNMENT
#if defined(EA_PLATFORM_APPLE)
#define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 16
#elif defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_ARM)
#define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 8
#elif defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_X86_64)
#define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 8
#else
#define EA_PLATFORM_MIN_MALLOC_ALIGNMENT (EA_PLATFORM_PTR_SIZE * 2)
#endif
#endif


// EA_MISALIGNED_SUPPORT_LEVEL
// Specifies if the processor can read and write built-in types that aren't
// naturally aligned.
//    0 - not supported. Likely causes an exception.
//    1 - supported but slow.
//    2 - supported and fast.
//
#ifndef EA_MISALIGNED_SUPPORT_LEVEL
#if defined(EA_PROCESSOR_X86_64)
#define EA_MISALIGNED_SUPPORT_LEVEL 2
#else
#define EA_MISALIGNED_SUPPORT_LEVEL 0
#endif
#endif

// Macro to determine if a Windows API partition is enabled. Always false on non Microsoft platforms.
#if !defined(EA_WINAPI_FAMILY_PARTITION)
#define EA_WINAPI_FAMILY_PARTITION(Partition) (0)
#endif


// EA_CACHE_LINE_SIZE
// Specifies the cache line size broken down by compile target.
// This the expected best guess values for the targets that we can make at compilation time.

#ifndef EA_CACHE_LINE_SIZE
#if   defined(EA_PROCESSOR_X86)
#define EA_CACHE_LINE_SIZE 32    // This is the minimum possible value.
#elif defined(EA_PROCESSOR_X86_64)
#define EA_CACHE_LINE_SIZE 64    // This is the minimum possible value
#elif defined(EA_PROCESSOR_ARM32)
#define EA_CACHE_LINE_SIZE 32    // This varies between implementations and is usually 32 or 64.
#elif defined(EA_PROCESSOR_ARM64)
#define EA_CACHE_LINE_SIZE 64    // Cache line Cortex-A8  (64 bytes) http://shervinemami.info/armAssembly.html however this remains to be mostly an assumption at this stage
#elif (EA_PLATFORM_WORD_SIZE == 4)
#define EA_CACHE_LINE_SIZE 32    // This is the minimum possible value
#else
#define EA_CACHE_LINE_SIZE 64    // This is the minimum possible value
#endif
#endif


#endif // INCLUDED_eaplatform_H