13 Commits

Author SHA1 Message Date
Jan Engelhardt
a7398dd65e Replace Zero_vector by vector{}
As far as the set of .cpp files which are using vecmat.h are
concerned, `Zero_vector` is out of reach for the compiler optimizer,
because it is extern / lives in a separate translation unit. An
expression like `x == Zero_vector` or `v = Zero_vector` thus has to
perform memory loads (for Zero_vector's x,y,z parts) before
comparison or copying, respectively. By using an immediate zero
vector `vector{}` instead, the unnecessary extra loads should go
away.

I present exhibit A:

```
void copyxx(vector *x) { *x = Zero_vector; }

4905e0: 48 8b 05 41 c0 56 00  movq 0x56c041(%rip),%rax  # 9fc628 <Zero_vector>
4905e7: 48 89 07              movq %rax,(%rdi)
4905ea: 8b 05 40 c0 56 00     movl 0x56c040(%rip),%eax  # 9fc630 <Zero_vector+0x8>
4905f0: 89 47 08              movl %eax,0x8(%rdi)
4905f3: c3                    ret
```

vs.

```
void copyxx(vector *x) { *x = vector{}; }

4905c0: 48 c7 07 00 00 00 00  movq $0x0,(%rdi)
4905c7: c7 47 08 00 00 00 00  movl $0x0,0x8(%rdi)
4905ce: c3                    ret
```
2025-06-03 12:01:17 +02:00
Jan Engelhardt
58aa9f55d9 lib: ditch vector::ne
C++ already has a built-in syntax for a null element; use it.
2025-06-03 10:46:20 +02:00
Jan Engelhardt
9a6b5da647 lib: add const qualifiers to vecmat function parameters 2025-05-21 16:38:08 +02:00
Jon Daniel
adda1c1f15 adaptive aligned std::array based vector types (#686) 2025-05-08 21:36:35 +02:00
Jan Engelhardt
006c2fb4ec build: split osiris_vector.h into header and implementation
Both e.g. AIGame3.cpp and DallasFuncs.cpp include
``osiris_vector.h``. Right now, this is not a problem because
DallasFuncs.cpp is not compiled itself, but included from
AIGame3.cpp, in other words, it is all just one translation unit.

I have a plan to do away with ``#include "DallasFuncs.cpp"``, which
means the linker invocation for AIGame3.so will have at least two
translation units, and thus two definitions of the osiris vector
functions, which is not allowed.

This also has the side-effect to reduce compile-time a little,
from 1m57.5s to 1m48.7s on my 1135G7 CPU using `make -j8`.
2024-09-09 14:57:44 +02:00
Thomas Roß
7b71873a69 [Cleanup] Removed function declarations that are not implemented. 2024-08-20 20:03:02 +02:00
GravisZro
3dcd21b717 Replace "unsigned short" with "uint16_t" 2024-05-23 23:03:29 -04:00
Azamat H. Hackimov
7352761bad Unbundle fix API from osiris_vector.h
Seem this was done to ease linking mission dlls. Now these missions are reusing fix as static library.
2024-05-03 16:22:35 -04:00
Chris Sarbora
1bc5648a9a Remove MacOS (Classic) code and all references (3/3)
At this point, all remaining references to `MACINTOSH` are either part
of multi-value conditionals that `unifdef` was unable to determine the
final value for, or a `#define`, or a comment. I manually go through the
files with a Ctrl+Shift+F search (ignoring legacy/, to preserve useful
historic knowledge) and clean up each usage.

As part of that search, I discovered `lib/mac/` which I deleted wholly.

Test Plan:
On Mac, build both Debug and Release
```
cmake --build --preset mac --config Debug
cmake --build --preset mac --config Release
```
2024-04-27 07:44:40 -07:00
Kevin Bentley
1f45163248 Updated source to reflect the license that this code is released under. 2024-04-20 09:57:49 -06:00
Azamat H. Hackimov
38128ea134 Additional clang-format 2024-04-17 00:25:04 +03:00
Kevin Bentley
c6640cc631 clang-format on everything. 2024-04-16 12:56:40 -06:00
Kevin Bentley
df209742fc Initial import 2024-04-15 21:43:29 -06:00