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>2022-09-25 18:39:45 +0300
committerJacques Lucke <jacques@blender.org>2022-09-25 18:39:45 +0300
commitc6e70e7bacf82b38ca7125d6821713a711489c0b (patch)
tree3679590f6254b7fbbd6623080edafe217f20c7b6 /source/blender/blenlib/BLI_vector.hh
parent0419ee871ff960f62e28a2a9fed764f66c616d71 (diff)
Cleanup: follow C++ type cast style guide in some files
https://wiki.blender.org/wiki/Style_Guide/C_Cpp#C.2B.2B_Type_Cast This was discussed in https://devtalk.blender.org/t/rfc-style-guide-for-type-casts-in-c-code/25907.
Diffstat (limited to 'source/blender/blenlib/BLI_vector.hh')
-rw-r--r--source/blender/blenlib/BLI_vector.hh13
1 files changed, 6 insertions, 7 deletions
diff --git a/source/blender/blenlib/BLI_vector.hh b/source/blender/blenlib/BLI_vector.hh
index 1f5f97d754d..d07c9aeeb3d 100644
--- a/source/blender/blenlib/BLI_vector.hh
+++ b/source/blender/blenlib/BLI_vector.hh
@@ -96,8 +96,7 @@ class Vector {
*/
#ifndef NDEBUG
int64_t debug_size_;
-# define UPDATE_VECTOR_SIZE(ptr) \
- (ptr)->debug_size_ = static_cast<int64_t>((ptr)->end_ - (ptr)->begin_)
+# define UPDATE_VECTOR_SIZE(ptr) (ptr)->debug_size_ = int64_t((ptr)->end_ - (ptr)->begin_)
#else
# define UPDATE_VECTOR_SIZE(ptr) ((void)0)
#endif
@@ -244,7 +243,7 @@ class Vector {
/* Copy from inline buffer to newly allocated buffer. */
const int64_t capacity = size;
begin_ = static_cast<T *>(
- allocator_.allocate(sizeof(T) * static_cast<size_t>(capacity), alignof(T), AT));
+ allocator_.allocate(sizeof(T) * size_t(capacity), alignof(T), AT));
capacity_end_ = begin_ + capacity;
uninitialized_relocate_n(other.begin_, size, begin_);
end_ = begin_ + size;
@@ -693,7 +692,7 @@ class Vector {
*/
int64_t size() const
{
- const int64_t current_size = static_cast<int64_t>(end_ - begin_);
+ const int64_t current_size = int64_t(end_ - begin_);
BLI_assert(debug_size_ == current_size);
return current_size;
}
@@ -813,7 +812,7 @@ class Vector {
{
for (const T *current = begin_; current != end_; current++) {
if (*current == value) {
- return static_cast<int64_t>(current - begin_);
+ return int64_t(current - begin_);
}
}
return -1;
@@ -905,7 +904,7 @@ class Vector {
*/
int64_t capacity() const
{
- return static_cast<int64_t>(capacity_end_ - begin_);
+ return int64_t(capacity_end_ - begin_);
}
/**
@@ -975,7 +974,7 @@ class Vector {
const int64_t size = this->size();
T *new_array = static_cast<T *>(
- allocator_.allocate(static_cast<size_t>(new_capacity) * sizeof(T), alignof(T), AT));
+ allocator_.allocate(size_t(new_capacity) * sizeof(T), alignof(T), AT));
try {
uninitialized_relocate_n(begin_, size, new_array);
}