Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2020-07-20 13:16:20 +0300
committerJacques Lucke <jacques@blender.org>2020-07-20 13:16:20 +0300
commit8cbbdedaf4dfec9e320e7e2be58b75d256950df1 (patch)
tree496b9620e11ac44e515b0bb4ca52c05834d557f9 /source/blender/simulation/intern/particle_allocator.cc
parent686ab4c9401a90b22fb17e46c992eb513fe4f693 (diff)
Refactor: Update integer type usage
This updates the usage of integer types in code I wrote according to our new style guides. Major changes: * Use signed instead of unsigned integers in many places. * C++ containers in blenlib use `int64_t` for size and indices now (instead of `uint`). * Hash values for C++ containers are 64 bit wide now (instead of 32 bit). I do hope that I broke no builds, but it is quite likely that some compiler reports slightly different errors. Please let me know when there are any errors. If the fix is small, feel free to commit it yourself. I compiled successfully on linux with gcc and on windows.
Diffstat (limited to 'source/blender/simulation/intern/particle_allocator.cc')
-rw-r--r--source/blender/simulation/intern/particle_allocator.cc14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/simulation/intern/particle_allocator.cc b/source/blender/simulation/intern/particle_allocator.cc
index b65c0197c76..eb1e998e63a 100644
--- a/source/blender/simulation/intern/particle_allocator.cc
+++ b/source/blender/simulation/intern/particle_allocator.cc
@@ -21,7 +21,7 @@ namespace blender::sim {
AttributesAllocator::~AttributesAllocator()
{
for (std::unique_ptr<AttributesBlock> &block : allocated_blocks_) {
- for (uint i : attributes_info_.index_range()) {
+ for (int i : attributes_info_.index_range()) {
const fn::CPPType &type = attributes_info_.type_of(i);
type.destruct_n(block->buffers[i], block->size);
MEM_freeN(block->buffers[i]);
@@ -29,13 +29,13 @@ AttributesAllocator::~AttributesAllocator()
}
}
-fn::MutableAttributesRef AttributesAllocator::allocate_uninitialized(uint size)
+fn::MutableAttributesRef AttributesAllocator::allocate_uninitialized(int size)
{
std::unique_ptr<AttributesBlock> block = std::make_unique<AttributesBlock>();
block->buffers = Array<void *>(attributes_info_.size(), nullptr);
block->size = size;
- for (uint i : attributes_info_.index_range()) {
+ for (int i : attributes_info_.index_range()) {
const fn::CPPType &type = attributes_info_.type_of(i);
void *buffer = MEM_mallocN_aligned(size * type.size(), type.alignment(), AT);
block->buffers[i] = buffer;
@@ -53,17 +53,17 @@ fn::MutableAttributesRef AttributesAllocator::allocate_uninitialized(uint size)
return attributes;
}
-fn::MutableAttributesRef ParticleAllocator::allocate(uint size)
+fn::MutableAttributesRef ParticleAllocator::allocate(int size)
{
const fn::AttributesInfo &info = attributes_allocator_.attributes_info();
fn::MutableAttributesRef attributes = attributes_allocator_.allocate_uninitialized(size);
- for (uint i : info.index_range()) {
+ for (int i : info.index_range()) {
const fn::CPPType &type = info.type_of(i);
StringRef name = info.name_of(i);
if (name == "ID") {
- uint start_id = next_id_.fetch_add(size);
+ int start_id = next_id_.fetch_add(size);
MutableSpan<int> ids = attributes.get<int>("ID");
- for (uint pindex : IndexRange(size)) {
+ for (int pindex : IndexRange(size)) {
ids[pindex] = start_id + pindex;
}
}