Go to file
Jacques Lucke 7314c86869 BLI: add fixed width integer type
This is intended to be used in the new exact mesh boolean algorithm by @howardt.
The new `BLI_fixed_width_int.hh` header provides types like `Int256` and
`UInt256` which are like e.g. `uint64_t` but with higher precision. The code
supports many different integer sizes.

The following operations are supported:
* Addition
* Subtraction
* Multiplication
* Comparisons
* Negation
* Conversion to and from other number types
* Conversion to and from string (based on `GMP`)

Division is not implemented. It could be implemented, but it's more complex and
is not required for the new mesh boolean algorithm.

Some alternatives to having a custom implementation have been discussed in
https://devtalk.blender.org/t/fixed-length-multiprecision-arithmetic/29189/.

Generally, the implementation is fairly straight forward. The main complexity is
the addition/multiplication algorithm which isn't too complicated. It's nice to
have control over this part as it allows us to optimize the code more if
necessary. Also, from what I understand, we might be able to benefit from some
special cases like multiplying a large integer with a smaller one.

I tried some different ways to optimize this already, but so far the normal
compiler optimization turned out to work best. Not sure if the same is true on
windows though, as it doesn't have native support for an `int128` which helps
the compiler understand what I'm doing. Alternatives I tried so far are using
intrinsics directly (mainly `_addcarry_u64` and similar), writing inline
assembly manually and copying the assembly output from the compiler. I assume
the assembly implementation didn't help for me because it prohibited other
compiler optimizations.

Pull Request: https://projects.blender.org/blender/blender/pulls/119528
2024-03-25 23:39:42 +01:00
.gitea Revert "Experiment: Add release notes PR link field to pull request template" 2024-02-16 16:41:07 +01:00
.github Docs: Replace most wiki links with links to new developer docs 2024-01-18 16:49:38 +01:00
build_files Cleanup: remove unused variables 2024-03-21 10:11:54 +11:00
doc Merge branch 'blender-v4.1-release' 2024-03-25 12:52:47 -04:00
extern Compositor: Port GLSL SMAA to CPU compositor 2024-03-25 14:21:00 +01:00
intern Fix #114634: correlated samples in volume when using equiangular sampling and light tree 2024-03-25 18:50:52 +01:00
lib Merge branch 'blender-v4.1-release' 2024-03-16 19:45:51 +01:00
locale I18N: Updated UI translstions from git/weblate repo (5f533cb92100b). 2024-03-25 09:59:29 +09:00
release Cleanup: Move remaining GPU headers to C++ 2024-03-23 01:24:18 +01:00
scripts Cleanup: Make format 2024-03-25 09:13:33 -04:00
source BLI: add fixed width integer type 2024-03-25 23:39:42 +01:00
tests Tests: temporarily disable light tree in the new test file 2024-03-25 19:43:14 +01:00
tools Cleanup: remove unused variables 2024-03-21 10:11:54 +11:00
.clang-format Clang-Format: Ensure single new line at the end of files 2024-02-22 14:42:10 +01:00
.clang-tidy
.editorconfig editorconfig: add HTML entry 2023-12-08 13:28:13 +11:00
.git-blame-ignore-revs
.gitignore Switch SVN to Git submodules using Git-LFS 2024-02-22 13:50:55 +01:00
.gitmodules Windows: Add ARM64 lib submodule 2024-03-14 18:12:51 +01:00
AUTHORS AUTHORS: add 7 new developers 2024-03-07 14:07:39 +11:00
CMakeLists.txt Cleanup: Centralize MSVC conformance related cmake items 2024-03-09 23:42:20 +01:00
COPYING
GNUmakefile Merge branch 'blender-v4.1-release' into main 2024-02-22 15:12:40 +01:00
make.bat Switch SVN to Git submodules using Git-LFS 2024-02-22 13:50:55 +01:00
pyproject.toml Black: skip string normalisation 2024-01-22 10:09:33 +01:00
README.md Docs: Replace most wiki links with links to new developer docs 2024-01-18 16:49:38 +01:00

Blender

Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline-modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.

Blender screenshot

Project Pages

Development

License

Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different, but compatible license.

See blender.org/about/license for details.