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/functions/FN_multi_function_params.hh
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/functions/FN_multi_function_params.hh')
-rw-r--r--source/blender/functions/FN_multi_function_params.hh58
1 files changed, 29 insertions, 29 deletions
diff --git a/source/blender/functions/FN_multi_function_params.hh b/source/blender/functions/FN_multi_function_params.hh
index e6683693a0a..9cce8bb7401 100644
--- a/source/blender/functions/FN_multi_function_params.hh
+++ b/source/blender/functions/FN_multi_function_params.hh
@@ -34,7 +34,7 @@ namespace blender::fn {
class MFParamsBuilder {
private:
const MFSignature *signature_;
- uint min_array_size_;
+ int64_t min_array_size_;
Vector<GVSpan> virtual_spans_;
Vector<GMutableSpan> mutable_spans_;
Vector<GVArraySpan> virtual_array_spans_;
@@ -43,12 +43,12 @@ class MFParamsBuilder {
friend class MFParams;
public:
- MFParamsBuilder(const MFSignature &signature, uint min_array_size)
+ MFParamsBuilder(const MFSignature &signature, int64_t min_array_size)
: signature_(&signature), min_array_size_(min_array_size)
{
}
- MFParamsBuilder(const class MultiFunction &fn, uint min_array_size);
+ MFParamsBuilder(const class MultiFunction &fn, int64_t min_array_size);
template<typename T> void add_readonly_single_input(const T *value)
{
@@ -96,21 +96,21 @@ class MFParamsBuilder {
vector_arrays_.append(&vector_array);
}
- GMutableSpan computed_array(uint param_index)
+ GMutableSpan computed_array(int param_index)
{
BLI_assert(ELEM(signature_->param_types[param_index].category(),
MFParamType::SingleOutput,
MFParamType::SingleMutable));
- uint data_index = signature_->data_index(param_index);
+ int data_index = signature_->data_index(param_index);
return mutable_spans_[data_index];
}
- GVectorArray &computed_vector_array(uint param_index)
+ GVectorArray &computed_vector_array(int param_index)
{
BLI_assert(ELEM(signature_->param_types[param_index].category(),
MFParamType::VectorOutput,
MFParamType::VectorMutable));
- uint data_index = signature_->data_index(param_index);
+ int data_index = signature_->data_index(param_index);
return *vector_arrays_[data_index];
}
@@ -119,13 +119,13 @@ class MFParamsBuilder {
{
UNUSED_VARS_NDEBUG(param_type);
#ifdef DEBUG
- uint param_index = this->current_param_index();
+ int param_index = this->current_param_index();
MFParamType expected_type = signature_->param_types[param_index];
BLI_assert(expected_type == param_type);
#endif
}
- uint current_param_index() const
+ int current_param_index() const
{
return virtual_spans_.size() + mutable_spans_.size() + virtual_array_spans_.size() +
vector_arrays_.size();
@@ -141,75 +141,75 @@ class MFParams {
{
}
- template<typename T> VSpan<T> readonly_single_input(uint param_index, StringRef name = "")
+ template<typename T> VSpan<T> readonly_single_input(int param_index, StringRef name = "")
{
return this->readonly_single_input(param_index, name).typed<T>();
}
- GVSpan readonly_single_input(uint param_index, StringRef name = "")
+ GVSpan readonly_single_input(int param_index, StringRef name = "")
{
this->assert_correct_param(param_index, name, MFParamType::SingleInput);
- uint data_index = builder_->signature_->data_index(param_index);
+ int data_index = builder_->signature_->data_index(param_index);
return builder_->virtual_spans_[data_index];
}
template<typename T>
- MutableSpan<T> uninitialized_single_output(uint param_index, StringRef name = "")
+ MutableSpan<T> uninitialized_single_output(int param_index, StringRef name = "")
{
return this->uninitialized_single_output(param_index, name).typed<T>();
}
- GMutableSpan uninitialized_single_output(uint param_index, StringRef name = "")
+ GMutableSpan uninitialized_single_output(int param_index, StringRef name = "")
{
this->assert_correct_param(param_index, name, MFParamType::SingleOutput);
- uint data_index = builder_->signature_->data_index(param_index);
+ int data_index = builder_->signature_->data_index(param_index);
return builder_->mutable_spans_[data_index];
}
- template<typename T> VArraySpan<T> readonly_vector_input(uint param_index, StringRef name = "")
+ template<typename T> VArraySpan<T> readonly_vector_input(int param_index, StringRef name = "")
{
return this->readonly_vector_input(param_index, name).typed<T>();
}
- GVArraySpan readonly_vector_input(uint param_index, StringRef name = "")
+ GVArraySpan readonly_vector_input(int param_index, StringRef name = "")
{
this->assert_correct_param(param_index, name, MFParamType::VectorInput);
- uint data_index = builder_->signature_->data_index(param_index);
+ int data_index = builder_->signature_->data_index(param_index);
return builder_->virtual_array_spans_[data_index];
}
- template<typename T> GVectorArrayRef<T> vector_output(uint param_index, StringRef name = "")
+ template<typename T> GVectorArrayRef<T> vector_output(int param_index, StringRef name = "")
{
return this->vector_output(param_index, name).typed<T>();
}
- GVectorArray &vector_output(uint param_index, StringRef name = "")
+ GVectorArray &vector_output(int param_index, StringRef name = "")
{
this->assert_correct_param(param_index, name, MFParamType::VectorOutput);
- uint data_index = builder_->signature_->data_index(param_index);
+ int data_index = builder_->signature_->data_index(param_index);
return *builder_->vector_arrays_[data_index];
}
- template<typename T> MutableSpan<T> single_mutable(uint param_index, StringRef name = "")
+ template<typename T> MutableSpan<T> single_mutable(int param_index, StringRef name = "")
{
return this->single_mutable(param_index, name).typed<T>();
}
- GMutableSpan single_mutable(uint param_index, StringRef name = "")
+ GMutableSpan single_mutable(int param_index, StringRef name = "")
{
this->assert_correct_param(param_index, name, MFParamType::SingleMutable);
- uint data_index = builder_->signature_->data_index(param_index);
+ int data_index = builder_->signature_->data_index(param_index);
return builder_->mutable_spans_[data_index];
}
- template<typename T> GVectorArrayRef<T> vector_mutable(uint param_index, StringRef name = "")
+ template<typename T> GVectorArrayRef<T> vector_mutable(int param_index, StringRef name = "")
{
return this->vector_mutable(param_index, name).typed<T>();
}
- GVectorArray &vector_mutable(uint param_index, StringRef name = "")
+ GVectorArray &vector_mutable(int param_index, StringRef name = "")
{
this->assert_correct_param(param_index, name, MFParamType::VectorMutable);
- uint data_index = builder_->signature_->data_index(param_index);
+ int data_index = builder_->signature_->data_index(param_index);
return *builder_->vector_arrays_[data_index];
}
private:
- void assert_correct_param(uint param_index, StringRef name, MFParamType param_type)
+ void assert_correct_param(int param_index, StringRef name, MFParamType param_type)
{
UNUSED_VARS_NDEBUG(param_index, name, param_type);
#ifdef DEBUG
@@ -220,7 +220,7 @@ class MFParams {
#endif
}
- void assert_correct_param(uint param_index, StringRef name, MFParamType::Category category)
+ void assert_correct_param(int param_index, StringRef name, MFParamType::Category category)
{
UNUSED_VARS_NDEBUG(param_index, name, category);
#ifdef DEBUG