From b1032f8fde46889a3b9bdb25333f26225a28d0f4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 26 Dec 2015 23:26:41 +0300 Subject: Add restrict keyword into dye. --- src/resources/dye/dye.cpp | 10 ++++++---- src/resources/dye/dye.h | 12 +++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'src/resources') diff --git a/src/resources/dye/dye.cpp b/src/resources/dye/dye.cpp index 3b7904122..e2544590f 100644 --- a/src/resources/dye/dye.cpp +++ b/src/resources/dye/dye.cpp @@ -34,7 +34,7 @@ #include "debug.h" -Dye::Dye(const std::string &description) +Dye::Dye(const std::string &restrict description) { for (int i = 0; i < dyePalateSize; ++i) mDyePalettes[i] = nullptr; @@ -139,7 +139,7 @@ void Dye::instantiate(std::string &restrict target, target = s.str(); } -int Dye::getType() const +int Dye::getType() const restrict2 { if (mDyePalettes[sPaleteIndex]) return 1; @@ -148,7 +148,8 @@ int Dye::getType() const return 0; } -void Dye::normalDye(uint32_t *restrict pixels, const int bufSize) const +void Dye::normalDye(uint32_t *restrict pixels, + const int bufSize) const restrict2 { if (!pixels) return; @@ -266,7 +267,8 @@ endlabel:{} #endif // ENABLE_CILKPLUS } -void Dye::normalOGLDye(uint32_t *restrict pixels, const int bufSize) const +void Dye::normalOGLDye(uint32_t *restrict pixels, + const int bufSize) const restrict2 { if (!pixels) return; diff --git a/src/resources/dye/dye.h b/src/resources/dye/dye.h index 02e1b3f05..d3d9ef654 100644 --- a/src/resources/dye/dye.h +++ b/src/resources/dye/dye.h @@ -45,7 +45,7 @@ class Dye final * The parts of string are separated by semi-colons. Each part starts * by an uppercase letter, followed by a colon and then a palette name. */ - explicit Dye(const std::string &dye); + explicit Dye(const std::string &restrict dye); A_DELETE_COPY(Dye) @@ -75,11 +75,13 @@ class Dye final /** * Return dye type for S - 1, for A - 2, 0 for other */ - int getType() const A_WARN_UNUSED; + int getType() const restrict2 A_WARN_UNUSED; - void normalDye(uint32_t *restrict pixels, const int bufSize) const; + void normalDye(uint32_t *restrict pixels, + const int bufSize) const restrict2; - void normalOGLDye(uint32_t *restrict pixels, const int bufSize) const; + void normalOGLDye(uint32_t *restrict pixels, + const int bufSize) const restrict2; private: /** @@ -87,7 +89,7 @@ class Dye final * * Red, Green, Yellow, Blue, Magenta, White (or rather gray), Simple. */ - DyePalette *mDyePalettes[dyePalateSize]; + DyePalette *restrict mDyePalettes[dyePalateSize]; }; #endif // RESOURCES_DYE_DYE_H -- cgit v1.2.3-60-g2f50