summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/common/gles2_cmd_utils.h
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 08:14:11 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 08:14:11 +0000
commit0c86dbf56c6f3e82ee748f34dca48aedf962dec2 (patch)
tree54c8674b9b6d1846f1b7c350494279d48045d4ef /gpu/command_buffer/common/gles2_cmd_utils.h
parentb69afd6f877e316184c5f8fa7283f10617e66366 (diff)
downloadchromium_src-0c86dbf56c6f3e82ee748f34dca48aedf962dec2.zip
chromium_src-0c86dbf56c6f3e82ee748f34dca48aedf962dec2.tar.gz
chromium_src-0c86dbf56c6f3e82ee748f34dca48aedf962dec2.tar.bz2
Resubmitting
http://codereview.chromium.org/668131 TEST=none BUG=none Review URL: http://codereview.chromium.org/668139 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40721 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/common/gles2_cmd_utils.h')
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.h b/gpu/command_buffer/common/gles2_cmd_utils.h
index c5cd792..318d2d8 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.h
+++ b/gpu/command_buffer/common/gles2_cmd_utils.h
@@ -18,12 +18,13 @@ namespace gles2 {
// returns true.
template <typename T>
inline bool SafeMultiply(T a, T b, T* dst) {
- *dst = 0;
if (b == 0) {
+ *dst = 0;
return true;
}
T v = a * b;
if (v / b != a) {
+ *dst = 0;
return false;
}
*dst = v;
@@ -38,8 +39,8 @@ inline bool SafeMultiplyUint32(uint32 a, uint32 b, uint32* dst) {
// Does an add checking for overflow. If there was no overflow returns true.
template <typename T>
inline bool SafeAdd(T a, T b, T* dst) {
- *dst = 0;
if (a + b < a) {
+ *dst = 0;
return false;
}
*dst = a + b;