[ember] 03/08: Import patch to replace MersenneTwister.h

Olek Wojnar olek-guest at moszumanska.debian.org
Mon Aug 15 02:00:22 UTC 2016


This is an automated email from the git hooks/post-receive script.

olek-guest pushed a commit to branch master
in repository ember.

commit 05b0cf7c2245ea4a5c2801d48197fffd09553f17
Author: Olek Wojnar <olek-dev at wojnar.org>
Date:   Sat Jul 16 23:22:12 2016 -0400

    Import patch to replace MersenneTwister.h
    
    Imported from the wfmath package. Avoids problems from ambiguous copyright of
    the original file.
---
 debian/changelog                                   |   2 +
 debian/patches/0017-replace-mersenne-twister.patch | 152 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 3 files changed, 155 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 7ab7363..ac8d066 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -36,6 +36,8 @@ ember (0.7.0-1) unstable; urgency=low
     - Remove pre-dependency on dpkg
     - Update standards to 3.9.8 (no changes)
     - Update Vcs lines for secure URIs
+  * Import patch from the wfmath package to replace MersenneTwister.h
+    -- Avoids problems from ambiguous copyright of the original file
 
  -- Olek Wojnar <olek-dev at wojnar.org>  Sun, 10 Jul 2016 21:20:01 -0400
 
diff --git a/debian/patches/0017-replace-mersenne-twister.patch b/debian/patches/0017-replace-mersenne-twister.patch
new file mode 100644
index 0000000..cc3b5ca
--- /dev/null
+++ b/debian/patches/0017-replace-mersenne-twister.patch
@@ -0,0 +1,152 @@
+Description: replace the Wagner MersenneTwister.h file with a custom one
+ There was a lack of complete clarity regarding whether a comment appearing in
+ this file constituted distribution license restrictions or not.  Replacing the
+ file entirely eliminates the ambiguity.
+Comment: The original upstream of the algorithm, has in the meantime removed the
+ request to email in the code and re-licensed under a BSD license. See
+ http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html
+Author: Stephen M. Webb <stephen.webb at bregmasoft.ca>
+
+--- /dev/null
++++ b/src/components/ogre/environment/pagedgeometry/include/MersenneTwister.h
+@@ -0,0 +1,140 @@
++// MersenneTwister.h
++//
++//  The WorldForge Project
++//  Copyright (C) 2013  The WorldForge Project
++//
++//  This program is free software; you can redistribute it and/or modify
++//  it under the terms of the GNU General Public License as published by
++//  the Free Software Foundation; either version 2 of the License, or
++//  (at your option) any later version.
++//
++//  This program is distributed in the hope that it will be useful,
++//  but WITHOUT ANY WARRANTY; without even the implied warranty of
++//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++//  GNU General Public License for more details.
++//
++//  You should have received a copy of the GNU General Public License along
++//  with this program; if not, write to the Free Software Foundation, Inc.,
++//  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++//
++//  For information about WorldForge and its authors, please contact
++//  the Worldforge Web Site at http://www.worldforge.org.
++//
++#ifndef WFMATH_MERSENNE_TWISTER_H_
++#define WFMATH_MERSENNE_TWISTER_H_
++
++#include <iosfwd>
++#include <climits>
++#include <cmath>
++#include <stdint.h>
++
++namespace WFMath {
++
++class MTRand {
++public:
++  typedef uint32_t uint32;
++
++  static const uint32 state_size = 624;
++
++public:
++  MTRand();
++  MTRand(uint32 oneSeed);
++  MTRand(uint32* const bigSeed, uint32 const seedLength = state_size);
++
++  // real-valued random numbers on [0, 1] or [0, n]
++  template<typename FloatT>
++    FloatT rand();
++  double rand();
++  double rand(const double& n);
++
++  // integer-valued random numbers on [0, 2^32-1] or [0, n]
++  uint32 randInt();
++  uint32 randInt(uint32 n);
++
++  void seed();
++  void seed(uint32 oneSeed);
++  void seed(uint32* const init_vector, uint32 init_vector_length = state_size);
++
++  std::ostream& save(std::ostream&) const;
++  std::istream& load(std::istream&);
++
++  static MTRand instance;
++
++private:
++  uint32 state[state_size];
++  uint32 index;
++};
++
++
++inline MTRand::MTRand(uint32 s)
++: index(0)
++{ seed(s); }
++
++inline MTRand::MTRand(uint32* const bigSeed, const uint32 seedLength)
++: index(0)
++{ seed(bigSeed, seedLength); }
++
++inline MTRand::MTRand()
++: index(0)
++{ seed(); }
++
++template<>
++inline float MTRand::rand<float>()
++{ return float(randInt()) * (1.0f/4294967295.0f); }
++
++template<>
++inline double MTRand::rand<double>()
++{ return double(randInt()) * (1.0/4294967295.0); }
++
++inline double MTRand::rand()
++{ return double(randInt()) * (1.0/4294967295.0); }
++
++inline double MTRand::rand( const double& n )
++{ return rand() * n; }
++
++
++inline MTRand::uint32 MTRand::randInt(uint32 n)
++{
++  uint32 used = n;
++  used |= used >> 1;
++  used |= used >> 2;
++  used |= used >> 4;
++  used |= used >> 8;
++  used |= used >> 16;
++
++  uint32 i;
++  do
++    i = randInt() & used;
++  while( i > n );
++  return i;
++}
++
++
++#if 0
++inline void MTRand::save(uint32* saveArray) const
++{
++  register uint32 *sa = saveArray;
++  register const uint32 *s = state;
++  register int i = state_size;
++  for( ; i--; *sa++ = *s++ ) {}
++  *sa = left;
++}
++
++
++inline void MTRand::load(uint32 *const loadArray)
++{
++  register uint32 *s = state;
++  register uint32 *la = loadArray;
++  register int i = state_size;
++  for( ; i--; *s++ = *la++ ) {}
++  left = *la;
++  pNext = &state[state_size-left];
++}
++#endif
++
++std::ostream& operator<<(std::ostream& os, MTRand const& mtrand);
++std::istream& operator>>(std::istream& is, MTRand& mtrand);
++
++} // namespace
++
++#endif // WFMATH_MERSENNE_TWISTER_H_
diff --git a/debian/patches/series b/debian/patches/series
index 441d02d..04b7453 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -2,3 +2,4 @@
 0014-add-missing-ogrelodstrategy.patch
 0015-verbose-configure-errors.patch
 0016-boost-1.53.patch
+0017-replace-mersenne-twister.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ember.git



More information about the Pkg-games-commits mailing list