1 // Copyright 2013 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_TRIG_TABLE_H_ 6 #define V8_TRIG_TABLE_H_ 7 8 9 namespace v8 { 10 namespace internal { 11 12 class TrigonometricLookupTable : public AllStatic { 13 public: 14 // Casting away const-ness to use as argument for typed array constructor. 15 static void* sin_table() { 16 return const_cast<double*>(&kSinTable[0]); 17 } 18 19 static void* cos_x_interval_table() { 20 return const_cast<double*>(&kCosXIntervalTable[0]); 21 } 22 23 static double samples_over_pi_half() { return kSamplesOverPiHalf; } 24 static int samples() { return kSamples; } 25 static int table_num_bytes() { return kTableSize * sizeof(*kSinTable); } 26 static int table_size() { return kTableSize; } 27 28 private: 29 static const double kSinTable[]; 30 static const double kCosXIntervalTable[]; 31 static const int kSamples; 32 static const int kTableSize; 33 static const double kSamplesOverPiHalf; 34 }; 35 36 } } // namespace v8::internal 37 38 #endif // V8_TRIG_TABLE_H_ 39