Allow SIMD vector unit to be toggled on/off #172

Currently defaults to off but future versions may default to on
This commit is contained in:
Lovell Fuller
2015-12-12 09:11:50 +00:00
parent 95cf35efc5
commit 32c4b9eff1
12 changed files with 107 additions and 10 deletions

2
src/sharp.cc Executable file → Normal file
View File

@@ -26,6 +26,8 @@ NAN_MODULE_INIT(init) {
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(concurrency)).ToLocalChecked());
Nan::Set(target, Nan::New("counters").ToLocalChecked(),
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(counters)).ToLocalChecked());
Nan::Set(target, Nan::New("simd").ToLocalChecked(),
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(simd)).ToLocalChecked());
Nan::Set(target, Nan::New("libvipsVersion").ToLocalChecked(),
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(libvipsVersion)).ToLocalChecked());
Nan::Set(target, Nan::New("format").ToLocalChecked(),

View File

@@ -1,6 +1,7 @@
#include <cmath>
#include <node.h>
#include <vips/vips.h>
#include <vips/vector.h>
#include "nan.h"
@@ -81,6 +82,20 @@ NAN_METHOD(counters) {
info.GetReturnValue().Set(counters);
}
/*
Get and set use of SIMD vector unit instructions
*/
NAN_METHOD(simd) {
HandleScope();
// Set state
if (info[0]->IsBoolean()) {
vips_vector_set_enabled(To<bool>(info[0]).FromJust());
}
// Get state
info.GetReturnValue().Set(New<Boolean>(vips_vector_isenabled()));
}
/*
Get libvips version
*/

1
src/utilities.h Executable file → Normal file
View File

@@ -6,6 +6,7 @@
NAN_METHOD(cache);
NAN_METHOD(concurrency);
NAN_METHOD(counters);
NAN_METHOD(simd);
NAN_METHOD(libvipsVersion);
NAN_METHOD(format);
NAN_METHOD(_maxColourDistance);