mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
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:
2
src/sharp.cc
Executable file → Normal file
2
src/sharp.cc
Executable file → Normal 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(),
|
||||
|
||||
@@ -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
1
src/utilities.h
Executable file → Normal 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);
|
||||
|
||||
Reference in New Issue
Block a user