Skip to content

Commit bb45773

Browse files
author
kevyuu
committed
Fix indentation of CDirQuantCacheBase.h
1 parent 02d6c6d commit bb45773

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

include/nbl/asset/utils/CDirQuantCacheBase.h

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class CDirQuantCacheBase
5757
return *this;
5858
}
5959

60-
hlsl::uint32_t4 getValue() const
60+
hlsl::uint32_t4 getValue() const
6161
{
6262
return { x, y, z, 0 };
6363
}
@@ -90,7 +90,7 @@ class CDirQuantCacheBase
9090
return *this;
9191
}
9292

93-
hlsl::uint32_t4 getValue() const
93+
hlsl::uint32_t4 getValue() const
9494
{
9595
return { x, y, z, w };
9696
}
@@ -131,7 +131,7 @@ class CDirQuantCacheBase
131131
return storage==other.storage;
132132
}
133133

134-
hlsl::uint32_t4 getValue() const
134+
hlsl::uint32_t4 getValue() const
135135
{
136136
constexpr auto storageBits = quantizationBits + 1u;
137137
const auto mask = (0x1u << storageBits) - 1u;
@@ -164,7 +164,7 @@ class CDirQuantCacheBase
164164
return *this;
165165
}
166166

167-
hlsl::uint32_t4 getValue() const
167+
hlsl::uint32_t4 getValue() const
168168
{
169169
return { x, y, z, 0 };
170170
}
@@ -196,7 +196,7 @@ class CDirQuantCacheBase
196196
return *this;
197197
}
198198

199-
hlsl::float32_t4 getValue() const
199+
hlsl::float32_t4 getValue() const
200200
{
201201
return { x, y, z, w };
202202
}
@@ -381,21 +381,21 @@ class CDirQuantCacheBase : public virtual core::IReferenceCounted, public impl::
381381
value_type_t<CacheFormat> quantize(const hlsl::vector<hlsl::float32_t, dimensions>& value)
382382
{
383383
auto to_float32_t4 = [](hlsl::vector<hlsl::float32_t, dimensions> src) -> hlsl::float32_t4
384-
{
385-
if constexpr(dimensions == 1)
386-
{
387-
return {src.x, 0, 0, 0};
388-
} else if constexpr (dimensions == 2)
389-
{
390-
return {src.x, src.y, 0, 0};
391-
} else if constexpr (dimensions == 3)
392-
{
393-
return {src.x, src.y, src.z, 0};
394-
} else if constexpr (dimensions == 4)
395-
{
396-
return {src.x, src.y, src.z, src.w};
397-
}
398-
};
384+
{
385+
if constexpr(dimensions == 1)
386+
{
387+
return {src.x, 0, 0, 0};
388+
} else if constexpr (dimensions == 2)
389+
{
390+
return {src.x, src.y, 0, 0};
391+
} else if constexpr (dimensions == 3)
392+
{
393+
return {src.x, src.y, src.z, 0};
394+
} else if constexpr (dimensions == 4)
395+
{
396+
return {src.x, src.y, src.z, src.w};
397+
}
398+
};
399399

400400
const auto negativeMask = to_float32_t4(lessThan(value, hlsl::vector<hlsl::float32_t, dimensions>(0.0f)));
401401

@@ -414,31 +414,31 @@ class CDirQuantCacheBase : public virtual core::IReferenceCounted, public impl::
414414
const auto fit = findBestFit<dimensions,quantizationBits>(absValue);
415415

416416
const auto abs_fit = to_float32_t4(abs(fit));
417-
quantized = hlsl::uint32_t4(abs_fit.x, abs_fit.y, abs_fit.z, abs_fit.w);
417+
quantized = hlsl::uint32_t4(abs_fit.x, abs_fit.y, abs_fit.z, abs_fit.w);
418418

419419
insertIntoCache<CacheFormat>(key,quantized);
420420
}
421421
}
422422

423423
auto switch_vec = [](hlsl::uint32_t4 val1, hlsl::uint32_t4 val2, hlsl::bool4 mask)
424-
{
424+
{
425425
hlsl::uint32_t4 retval;
426426
retval.x = mask.x ? val2.x : val1.x;
427427
retval.y = mask.y ? val2.y : val1.y;
428428
retval.z = mask.z ? val2.z : val1.z;
429429
retval.w = mask.w ? val2.w : val1.w;
430430
return retval;
431-
};
431+
};
432432
;
433-
// create all one bits
434-
const hlsl::uint32_t4 xorflag((0x1u << (quantizationBits + 1u)) - 1u);
433+
// create all one bits
434+
const hlsl::uint32_t4 xorflag((0x1u << (quantizationBits + 1u)) - 1u);
435435

436-
// for positive number xoring with 0 keep its value
437-
// for negative number we xor with all one which will flip the bits, then we add one later. Flipping the bits then adding one will turn positive number into negative number
438-
auto restoredAsVec = quantized.getValue() ^ switch_vec(hlsl::uint32_t4(0u), hlsl::uint32_t4(xorflag), negativeMask);
439-
restoredAsVec += switch_vec(hlsl::uint32_t4(0u), hlsl::uint32_t4(1u), negativeMask);
436+
// for positive number xoring with 0 keep its value
437+
// for negative number we xor with all one which will flip the bits, then we add one later. Flipping the bits then adding one will turn positive number into negative number
438+
auto restoredAsVec = quantized.getValue() ^ switch_vec(hlsl::uint32_t4(0u), hlsl::uint32_t4(xorflag), negativeMask);
439+
restoredAsVec += switch_vec(hlsl::uint32_t4(0u), hlsl::uint32_t4(1u), negativeMask);
440440

441-
return value_type_t<CacheFormat>(restoredAsVec);
441+
return value_type_t<CacheFormat>(restoredAsVec);
442442
}
443443

444444
template<uint32_t dimensions, uint32_t quantizationBits>

0 commit comments

Comments
 (0)