ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/noise.h
(Generate patch)

Comparing deliantra/server/include/noise.h (file contents):
Revision 1.10 by root, Sat Apr 30 05:41:17 2011 UTC vs.
Revision 1.11 by root, Sat Apr 30 11:02:25 2011 UTC

145{ 145{
146}; 146};
147 147
148///////////////////////////////////////////////////////////////////////////// 148/////////////////////////////////////////////////////////////////////////////
149 149
150template<int N, typename T = uint8_t> 150template< int N, typename T>
151struct permutation 151struct permutation
152{ 152{
153 T pmap[N]; 153 T pmap[N];
154 154
155 void seed (seedable_rand_gen &rng); 155 void seed (seedable_rand_gen &rng);
156 156
157 T operator ()(T v) func_pure 157 T operator ()(T v) func_pure
158 { 158 {
159 return pmap[v & (N - 1)]; 159 return pmap[v & T(N - 1)];
160 } 160 }
161}; 161};
162 162
163///////////////////////////////////////////////////////////////////////////// 163/////////////////////////////////////////////////////////////////////////////
164 164
165template<class vec_t> 165template<class vec_t>
166struct noise_gen_base 166struct noise_gen_base
167{ 167{
168 permutation<256, uint8_t> rvmap[vec_t::numElements]; 168 permutation<256, uint8_t> rvmap[vec_t::numElements + 1];
169 169
170 typedef typename vec_t::T_numtype value_t; 170 typedef typename vec_t::T_numtype value_t;
171 171
172 void seed (seedable_rand_gen &rng); 172 void seed (seedable_rand_gen &rng);
173 void seed (seed_t seed); 173 void seed (seed_t seed);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines