Skip to content

Commit 163d98d

Browse files
Merge pull request #204 from dreamer-coding/main
2 parents 28a15f2 + 939bbff commit 163d98d

File tree

17 files changed

+519
-528
lines changed

17 files changed

+519
-528
lines changed

LICENSE

Lines changed: 201 additions & 373 deletions
Large diffs are not rendered by default.

code/logic/common.c

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
/*
1+
/**
22
* -----------------------------------------------------------------------------
33
* Project: Fossil Logic
44
*
5-
* This file is part of the Fossil Logic project, which aims to develop high-
6-
* performance, cross-platform applications and libraries. The code contained
7-
* herein is subject to the terms and conditions defined in the project license.
5+
* This file is part of the Fossil Logic project, which aims to develop
6+
* high-performance, cross-platform applications and libraries. The code
7+
* contained herein is licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License. You may obtain
9+
* a copy of the License at:
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
818
*
919
* Author: Michael Gene Brockus (Dreamer)
1020
* Date: 04/05/2014
@@ -923,8 +933,36 @@ int pizza_sys_hostinfo_get_memory(pizza_sys_hostinfo_memory_t *info) {
923933

924934
int pizza_sys_hostinfo_get_endianness(pizza_sys_hostinfo_endianness_t *info) {
925935
if (!info) return -1;
926-
uint16_t test = 0x0001;
927-
info->is_little_endian = (*(uint8_t*)&test) ? 1 : 0;
936+
937+
// --- Compile-time detection if supported ---
938+
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__)
939+
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
940+
info->is_little_endian = 1;
941+
info->is_big_endian = 0;
942+
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
943+
info->is_little_endian = 0;
944+
info->is_big_endian = 1;
945+
#else
946+
#error "Unknown byte order at compile-time"
947+
#endif
948+
#else
949+
// --- Runtime fallback using union ---
950+
union {
951+
uint16_t value;
952+
uint8_t bytes[2];
953+
} test;
954+
955+
test.value = 0x0102;
956+
957+
if (test.bytes[0] == 0x02) {
958+
info->is_little_endian = 1;
959+
info->is_big_endian = 0;
960+
} else {
961+
info->is_little_endian = 0;
962+
info->is_big_endian = 1;
963+
}
964+
#endif
965+
928966
return 0;
929967
}
930968

code/logic/fossil/pizza/assume.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
/*
1+
/**
22
* -----------------------------------------------------------------------------
33
* Project: Fossil Logic
44
*
5-
* This file is part of the Fossil Logic project, which aims to develop high-
6-
* performance, cross-platform applications and libraries. The code contained
7-
* herein is subject to the terms and conditions defined in the project license.
5+
* This file is part of the Fossil Logic project, which aims to develop
6+
* high-performance, cross-platform applications and libraries. The code
7+
* contained herein is licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License. You may obtain
9+
* a copy of the License at:
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
818
*
919
* Author: Michael Gene Brockus (Dreamer)
1020
* Date: 04/05/2014

code/logic/fossil/pizza/common.h

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
/*
1+
/**
22
* -----------------------------------------------------------------------------
33
* Project: Fossil Logic
44
*
5-
* This file is part of the Fossil Logic project, which aims to develop high-
6-
* performance, cross-platform applications and libraries. The code contained
7-
* herein is subject to the terms and conditions defined in the project license.
5+
* This file is part of the Fossil Logic project, which aims to develop
6+
* high-performance, cross-platform applications and libraries. The code
7+
* contained herein is licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License. You may obtain
9+
* a copy of the License at:
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
818
*
919
* Author: Michael Gene Brockus (Dreamer)
1020
* Date: 04/05/2014
@@ -334,7 +344,8 @@ typedef struct {
334344

335345
// Endianness information structure
336346
typedef struct {
337-
int is_little_endian; // 1 if little-endian, 0 if big-endian
347+
int is_little_endian;
348+
int is_big_endian;
338349
} pizza_sys_hostinfo_endianness_t;
339350

340351
// System information structure

code/logic/fossil/pizza/framework.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
/*
1+
/**
22
* -----------------------------------------------------------------------------
33
* Project: Fossil Logic
44
*
5-
* This file is part of the Fossil Logic project, which aims to develop high-
6-
* performance, cross-platform applications and libraries. The code contained
7-
* herein is subject to the terms and conditions defined in the project license.
5+
* This file is part of the Fossil Logic project, which aims to develop
6+
* high-performance, cross-platform applications and libraries. The code
7+
* contained herein is licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License. You may obtain
9+
* a copy of the License at:
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
818
*
919
* Author: Michael Gene Brockus (Dreamer)
1020
* Date: 04/05/2014

code/logic/fossil/pizza/mark.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
/*
1+
/**
22
* -----------------------------------------------------------------------------
33
* Project: Fossil Logic
44
*
5-
* This file is part of the Fossil Logic project, which aims to develop high-
6-
* performance, cross-platform applications and libraries. The code contained
7-
* herein is subject to the terms and conditions defined in the project license.
5+
* This file is part of the Fossil Logic project, which aims to develop
6+
* high-performance, cross-platform applications and libraries. The code
7+
* contained herein is licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License. You may obtain
9+
* a copy of the License at:
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
818
*
919
* Author: Michael Gene Brockus (Dreamer)
1020
* Date: 04/05/2014

code/logic/fossil/pizza/mock.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
/*
1+
/**
22
* -----------------------------------------------------------------------------
33
* Project: Fossil Logic
44
*
5-
* This file is part of the Fossil Logic project, which aims to develop high-
6-
* performance, cross-platform applications and libraries. The code contained
7-
* herein is subject to the terms and conditions defined in the project license.
5+
* This file is part of the Fossil Logic project, which aims to develop
6+
* high-performance, cross-platform applications and libraries. The code
7+
* contained herein is licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License. You may obtain
9+
* a copy of the License at:
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
818
*
919
* Author: Michael Gene Brockus (Dreamer)
1020
* Date: 04/05/2014

code/logic/fossil/pizza/sanity.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
/*
1+
/**
22
* -----------------------------------------------------------------------------
33
* Project: Fossil Logic
44
*
5-
* This file is part of the Fossil Logic project, which aims to develop high-
6-
* performance, cross-platform applications and libraries. The code contained
7-
* herein is subject to the terms and conditions defined in the project license.
5+
* This file is part of the Fossil Logic project, which aims to develop
6+
* high-performance, cross-platform applications and libraries. The code
7+
* contained herein is licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License. You may obtain
9+
* a copy of the License at:
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
818
*
919
* Author: Michael Gene Brockus (Dreamer)
1020
* Date: 04/05/2014

code/logic/fossil/pizza/test.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
/*
1+
/**
22
* -----------------------------------------------------------------------------
33
* Project: Fossil Logic
44
*
5-
* This file is part of the Fossil Logic project, which aims to develop high-
6-
* performance, cross-platform applications and libraries. The code contained
7-
* herein is subject to the terms and conditions defined in the project license.
5+
* This file is part of the Fossil Logic project, which aims to develop
6+
* high-performance, cross-platform applications and libraries. The code
7+
* contained herein is licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License. You may obtain
9+
* a copy of the License at:
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
818
*
919
* Author: Michael Gene Brockus (Dreamer)
1020
* Date: 04/05/2014

code/logic/mark.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
1-
/*
1+
/**
22
* -----------------------------------------------------------------------------
33
* Project: Fossil Logic
44
*
5-
* This file is part of the Fossil Logic project, which aims to develop high-
6-
* performance, cross-platform applications and libraries. The code contained
7-
* herein is subject to the terms and conditions defined in the project license.
5+
* This file is part of the Fossil Logic project, which aims to develop
6+
* high-performance, cross-platform applications and libraries. The code
7+
* contained herein is licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License. You may obtain
9+
* a copy of the License at:
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16+
* License for the specific language governing permissions and limitations
17+
* under the License.
818
*
919
* Author: Michael Gene Brockus (Dreamer)
1020
* Date: 04/05/2014

0 commit comments

Comments
 (0)