From patchwork Mon Sep 19 15:37:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: alexandros.frantzis@linaro.org X-Patchwork-Id: 4183 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9219723EFB for ; Mon, 19 Sep 2011 15:37:14 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 7BDD1A189E8 for ; Mon, 19 Sep 2011 15:37:14 +0000 (UTC) Received: by fxe23 with SMTP id 23so5743579fxe.11 for ; Mon, 19 Sep 2011 08:37:14 -0700 (PDT) Received: by 10.223.34.143 with SMTP id l15mr5368269fad.46.1316446634274; Mon, 19 Sep 2011 08:37:14 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.18.198 with SMTP id y6cs43789lad; Mon, 19 Sep 2011 08:37:13 -0700 (PDT) Received: by 10.227.196.143 with SMTP id eg15mr2064800wbb.65.1316446633268; Mon, 19 Sep 2011 08:37:13 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com. [91.189.90.7]) by mx.google.com with ESMTPS id fr15si9441528wbb.50.2011.09.19.08.37.13 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 19 Sep 2011 08:37:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1R5fuC-00053b-Of for ; Mon, 19 Sep 2011 15:37:12 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id AB1CAE0106 for ; Mon, 19 Sep 2011 15:37:12 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: glmark2 X-Launchpad-Branch: ~glmark2-dev/glmark2/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 135 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~glmark2-dev/glmark2/trunk] Rev 135: LibMatrix: Sync with upstream trunk at rev. 25. Message-Id: <20110919153712.30280.73060.launchpad@ackee.canonical.com> Date: Mon, 19 Sep 2011 15:37:12 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13980"; Instance="initZopeless config overlay" X-Launchpad-Hash: 78625262e098d570657e4d5fc24eae7496dd4545 ------------------------------------------------------------ revno: 135 committer: Alexandros Frantzis branch nick: trunk timestamp: Mon 2011-09-19 18:30:13 +0300 message: LibMatrix: Sync with upstream trunk at rev. 25. modified: src/libmatrix/Makefile src/libmatrix/mat.h src/libmatrix/vec.h --- lp:glmark2 https://code.launchpad.net/~glmark2-dev/glmark2/trunk You are subscribed to branch lp:glmark2. To unsubscribe from this branch go to https://code.launchpad.net/~glmark2-dev/glmark2/trunk/+edit-subscription === modified file 'src/libmatrix/Makefile' --- src/libmatrix/Makefile 2011-06-17 07:54:50 +0000 +++ src/libmatrix/Makefile 2011-09-19 15:30:13 +0000 @@ -1,17 +1,35 @@ -TARGETS = libmatrix.a matrix_inverse_test -SRCS = mat.cc program.cc matrix_inverse_test.cc -OBJS = $(SRCS:.cc=.o) CXXFLAGS = -Wall -Werror -pedantic -O3 - -default: $(TARGETS) - -mat.o : mat.cc mat.h -program.o: program.cc program.h -matrix_inverse_test.o: matrix_inverse_test.cc mat.h -matrix_inverse_test: matrix_inverse_test.o libmatrix.a - $(CXX) -o $@ $? +LIBMATRIX = libmatrix.a +LIBSRCS = mat.cc program.cc +LIBOBJS = $(LIBSRCS:.cc=.o) +TESTDIR = test +LIBMATRIX_TESTS = $(TESTDIR)/libmatrix_test +TESTSRCS = $(TESTDIR)/options.cc \ + $(TESTDIR)/const_vec_test.cc \ + $(TESTDIR)/inverse_test.cc \ + $(TESTDIR)/transpose_test.cc \ + $(TESTDIR)/libmatrix_test.cc +TESTOBJS = $(TESTSRCS:.cc=.o) + +# Make sure to build both the library targets and the tests, and generate +# a make failure if the tests don't pass. +default: $(LIBMATRIX) $(LIBMATRIX_TESTS) run_tests + +# Main library targets here. +mat.o : mat.cc mat.h vec.h +program.o: program.cc program.h mat.h vec.h libmatrix.a : mat.o mat.h stack.h vec.h program.o program.h - $(AR) -r $@ $(OBJS) + $(AR) -r $@ $(LIBOBJS) +# Tests and execution targets here. +$(TESTDIR)/options.o: $(TESTDIR)/options.cc $(TESTDIR)/libmatrix_test.h +$(TESTDIR)/libmatrix_test.o: $(TESTDIR)/libmatrix_test.cc $(TESTDIR)/libmatrix_test.h $(TESTDIR)/inverse_test.h $(TESTDIR)/transpose_test.h +$(TESTDIR)/const_vec_test.o: $(TESTDIR)/const_vec_test.cc $(TESTDIR)/const_vec_test.h $(TESTDIR)/libmatrix_test.h vec.h +$(TESTDIR)/inverse_test.o: $(TESTDIR)/inverse_test.cc $(TESTDIR)/inverse_test.h $(TESTDIR)/libmatrix_test.h mat.h +$(TESTDIR)/transpose_test.o: $(TESTDIR)/transpose_test.cc $(TESTDIR)/transpose_test.h $(TESTDIR)/libmatrix_test.h mat.h +$(TESTDIR)/libmatrix_test: $(TESTOBJS) libmatrix.a + $(CXX) -o $@ $^ +run_tests: $(LIBMATRIX_TESTS) + $(LIBMATRIX_TESTS) clean : - $(RM) $(OBJS) $(TARGETS) + $(RM) $(LIBOBJS) $(TESTOBJS) $(LIBMATRIX) $(LIBMATRIX_TESTS) === modified file 'src/libmatrix/mat.h' --- src/libmatrix/mat.h 2011-08-16 07:50:49 +0000 +++ src/libmatrix/mat.h 2011-09-19 15:30:13 +0000 @@ -299,8 +299,8 @@ m_[8] = m.m_[8]; } tmat3(const T& c0r0, const T& c0r1, const T& c0r2, - const T& c1r0, const T& c1r1, const T& c1r2, - const T& c2r0, const T& c2r1, const T& c2r2) + const T& c1r0, const T& c1r1, const T& c1r2, + const T& c2r0, const T& c2r1, const T& c2r2) { m_[0] = c0r0; m_[1] = c0r1; === modified file 'src/libmatrix/vec.h' --- src/libmatrix/vec.h 2011-06-17 07:54:50 +0000 +++ src/libmatrix/vec.h 2011-09-19 15:30:13 +0000 @@ -1,5 +1,5 @@ // -// Copyright (c) 2010 Linaro Limited +// Copyright (c) 2010-2011 Linaro Limited // // All rights reserved. This program and the accompanying materials // are made available under the terms of the MIT License which accompanies @@ -64,7 +64,19 @@ return *this; } - const tvec2 operator/(const T& rhs) + const tvec2 operator/(const T& rhs) const + { + return tvec2(*this) /= rhs; + } + + tvec2& operator/=(const tvec2& rhs) + { + x_ /= rhs.x_; + y_ /= rhs.y_; + return *this; + } + + const tvec2 operator/(const tvec2& rhs) const { return tvec2(*this) /= rhs; } @@ -76,7 +88,19 @@ return *this; } - const tvec2 operator*(const T& rhs) + const tvec2 operator*(const T& rhs) const + { + return tvec2(*this) *= rhs; + } + + tvec2& operator*=(const tvec2& rhs) + { + x_ *= rhs.x_; + y_ *= rhs.y_; + return *this; + } + + const tvec2 operator*(const tvec2& rhs) const { return tvec2(*this) *= rhs; } @@ -88,7 +112,7 @@ return *this; } - const tvec2 operator+(const T& rhs) + const tvec2 operator+(const T& rhs) const { return tvec2(*this) += rhs; } @@ -100,7 +124,7 @@ return *this; } - const tvec2 operator+(const tvec2& rhs) + const tvec2 operator+(const tvec2& rhs) const { return tvec2(*this) += rhs; } @@ -112,7 +136,7 @@ return *this; } - const tvec2 operator-(const T& rhs) + const tvec2 operator-(const T& rhs) const { return tvec2(*this) -= rhs; } @@ -124,7 +148,7 @@ return *this; } - const tvec2 operator-(const tvec2& rhs) + const tvec2 operator-(const tvec2& rhs) const { return tvec2(*this) -= rhs; } @@ -206,7 +230,20 @@ return *this; } - const tvec3 operator/(const T& rhs) + const tvec3 operator/(const T& rhs) const + { + return tvec3(*this) /= rhs; + } + + tvec3& operator/=(const tvec3& rhs) + { + x_ /= rhs.x_; + y_ /= rhs.y_; + z_ /= rhs.z_; + return *this; + } + + const tvec3 operator/(const tvec3& rhs) const { return tvec3(*this) /= rhs; } @@ -219,7 +256,20 @@ return *this; } - const tvec3 operator*(const T& rhs) + const tvec3 operator*(const T& rhs) const + { + return tvec3(*this) *= rhs; + } + + tvec3& operator*=(const tvec3& rhs) + { + x_ *= rhs.x_; + y_ *= rhs.y_; + z_ *= rhs.z_; + return *this; + } + + const tvec3 operator*(const tvec3& rhs) const { return tvec3(*this) *= rhs; } @@ -232,7 +282,7 @@ return *this; } - const tvec3 operator+(const T& rhs) + const tvec3 operator+(const T& rhs) const { return tvec3(*this) += rhs; } @@ -245,7 +295,7 @@ return *this; } - const tvec3 operator+(const tvec3& rhs) + const tvec3 operator+(const tvec3& rhs) const { return tvec3(*this) += rhs; } @@ -258,7 +308,7 @@ return *this; } - const tvec3 operator-(const T& rhs) + const tvec3 operator-(const T& rhs) const { return tvec3(*this) -= rhs; } @@ -271,7 +321,7 @@ return *this; } - const tvec3 operator-(const tvec3& rhs) + const tvec3 operator-(const tvec3& rhs) const { return tvec3(*this) -= rhs; } @@ -370,7 +420,21 @@ return *this; } - const tvec4 operator/(const T& rhs) + const tvec4 operator/(const T& rhs) const + { + return tvec4(*this) /= rhs; + } + + tvec4& operator/=(const tvec4& rhs) + { + x_ /= rhs.x_; + y_ /= rhs.y_; + z_ /= rhs.z_; + w_ /= rhs.w_; + return *this; + } + + const tvec4 operator/(const tvec4& rhs) const { return tvec4(*this) /= rhs; } @@ -384,7 +448,21 @@ return *this; } - const tvec4 operator*(const T& rhs) + const tvec4 operator*(const T& rhs) const + { + return tvec4(*this) *= rhs; + } + + tvec4& operator*=(const tvec4& rhs) + { + x_ *= rhs.x_; + y_ *= rhs.y_; + z_ *= rhs.z_; + w_ *= rhs.w_; + return *this; + } + + const tvec4 operator*(const tvec4& rhs) const { return tvec4(*this) *= rhs; } @@ -398,7 +476,7 @@ return *this; } - const tvec4 operator+(const T& rhs) + const tvec4 operator+(const T& rhs) const { return tvec4(*this) += rhs; } @@ -412,7 +490,7 @@ return *this; } - const tvec4 operator+(const tvec4& rhs) + const tvec4 operator+(const tvec4& rhs) const { return tvec4(*this) += rhs; } @@ -426,7 +504,7 @@ return *this; } - const tvec4 operator-(const T& rhs) + const tvec4 operator-(const T& rhs) const { return tvec4(*this) -= rhs; } @@ -440,7 +518,7 @@ return *this; } - const tvec4 operator-(const tvec4& rhs) + const tvec4 operator-(const tvec4& rhs) const { return tvec4(*this) -= rhs; }