1//===--------------------------------------------------------------------===//
2// numeric_inplace_operators.cpp
3// Description: This file contains the implementation of numeric inplace ops
4// += *= /= -= %=
5//===--------------------------------------------------------------------===//
6
7#include "duckdb/common/vector_operations/vector_operations.hpp"
8
9#include <algorithm>
10
11using namespace duckdb;
12using namespace std;
13
14//===--------------------------------------------------------------------===//
15// In-Place Addition
16//===--------------------------------------------------------------------===//
17
18void VectorOperations::AddInPlace(Vector &input, int64_t right, idx_t count) {
19 assert(input.type == TypeId::POINTER);
20 switch (input.vector_type) {
21 case VectorType::CONSTANT_VECTOR: {
22 assert(!ConstantVector::IsNull(input));
23 auto data = ConstantVector::GetData<uintptr_t>(input);
24 *data += right;
25 break;
26 }
27 default: {
28 assert(input.vector_type == VectorType::FLAT_VECTOR);
29 auto data = FlatVector::GetData<uintptr_t>(input);
30 for (idx_t i = 0; i < count; i++) {
31 data[i] += right;
32 }
33 break;
34 }
35 }
36}
37