mirror of
https://github.com/godotengine/godot-benchmarks.git
synced 2026-01-04 06:10:04 +03:00
Fix build errors on MSVC (#94)
This commit is contained in:
committed by
GitHub
parent
31c952684a
commit
a8ee8585b5
@@ -17,7 +17,7 @@ void CPPBenchmarkArray::_bind_methods() {
|
||||
}
|
||||
|
||||
void CPPBenchmarkArray::benchmark_fill_loop() {
|
||||
int length = 10000000;
|
||||
constexpr int length = 10000000;
|
||||
int array[length];
|
||||
for (int i = 0; i < length; i++) {
|
||||
array[i] = 1234;
|
||||
@@ -25,7 +25,7 @@ void CPPBenchmarkArray::benchmark_fill_loop() {
|
||||
}
|
||||
|
||||
void CPPBenchmarkArray::benchmark_int32_array() {
|
||||
TypedArray<int> array;
|
||||
TypedArray<int32_t> array;
|
||||
|
||||
for(int i = 0; i < iterations; i++)
|
||||
array.push_back(i);
|
||||
|
||||
@@ -11,7 +11,7 @@ void CPPBenchmarkNbody::_bind_methods() {
|
||||
}
|
||||
|
||||
void CPPBenchmarkNbody::offset_momentum() {
|
||||
double px, py, pz = 0;
|
||||
double px = 0, py = 0, pz = 0;
|
||||
for(char i = 0; i < body_count; i++) {
|
||||
Body b = bodies[i];
|
||||
px -= b.vx * b.mass;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <godot_cpp/variant/utility_functions.hpp>
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
using namespace godot;
|
||||
|
||||
void CPPBenchmarkSpectralNorm::_bind_methods() {
|
||||
@@ -44,9 +46,9 @@ void CPPBenchmarkSpectralNorm::multiply_at_av(double v[], double tmp[], double a
|
||||
}
|
||||
|
||||
void CPPBenchmarkSpectralNorm::calculate_spectral_norm(int n) {
|
||||
double u[n];
|
||||
double v[n];
|
||||
double tmp[n];
|
||||
double *u = (double *)alloca(sizeof(double) * n);
|
||||
double *v = (double *)alloca(sizeof(double) * n);
|
||||
double *tmp = (double *)alloca(sizeof(double) * n);
|
||||
|
||||
// create unit vector
|
||||
for (int i = 0; i < n; i++)
|
||||
|
||||
Reference in New Issue
Block a user