Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store index/dimension in 8 bits #8028

Merged
merged 4 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Installation/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ Release date: October 2023
- Added three functions `vertices()` to the class `Triangulation_3`.
Each of them returns an array containing the vertices of the given triangulation simplex.

### [dD Triangulations](https://doc.cgal.org/6.0/Manual/packages.html#PkgTriangulations)
- **Breaking change**: `CGAL::TDS_full_cell_mirror_storage_policy` is now unsupported in dimension larger than 127.

[Release 5.6](https://github.com/CGAL/cgal/releases/tag/v5.6)
-----------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ indices are not stored).
<LI>`CGAL::TDS_full_cell_default_storage_policy`. In that case, the mirror
indices are not stored.
<LI>`CGAL::TDS_full_cell_mirror_storage_policy`. In that case, the mirror
indices are stored.
indices are stored. This last policy is not supported when the dimension is larger than 127.
</UL>
See the user manual for how to choose the second option.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

#include <CGAL/license/Triangulation.h>


#include <CGAL/TDS_full_cell_default_storage_policy.h>
#include <cstdint>

namespace CGAL {

Expand All @@ -30,7 +30,7 @@ struct TFC_data< Vertex_handle, Full_cell_handle, Maximal_dimension, TDS_full_
typedef TFC_data< Vertex_handle, Full_cell_handle, Maximal_dimension, TDS_full_cell_default_storage_policy > Base;
typedef typename Base::Vertex_handle_array Vertex_handle_array;
typedef typename Base::Full_cell_handle_array Full_cell_handle_array;
typedef typename internal::S_or_D_array< int, typename Base::Dimen_plus > Int_array;
typedef typename internal::S_or_D_array< std::int_least8_t, typename Base::Dimen_plus > Int_array;

private:
Int_array mirror_vertices_;
Expand All @@ -42,7 +42,7 @@ struct TFC_data< Vertex_handle, Full_cell_handle, Maximal_dimension, TDS_full_

void set_mirror_index(const int i, const int index)
{
mirror_vertices_[i] = index;
mirror_vertices_[i] = static_cast<std::int_least8_t>(index);
Copy link
Member

@sloriot sloriot Feb 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

triggers:

/mnt/testsuite/include/CGAL/TDS_full_cell_mirror_storage_policy.h:45:29: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=]
   45 |         mirror_vertices_[i] = static_cast<std::int_least8_t>(index);

here and here for example.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-Wstringop-overflow and -Warray-bounds are 2 of the worst offenders among the recent gcc warnings that only ever give false positives...

}
int mirror_index(const int i) const
{
Expand Down