@@ -1158,7 +1158,7 @@ void IndexOfString(const FunctionCallbackInfo<Value>& args) { |
1158 | 1158 | } |
1159 | 1159 |
|
1160 | 1160 | args.GetReturnValue().Set(result >= search_end ? -1 |
1161 | | - : static_cast<int>(result)); |
| 1161 | + : static_cast<double>(result)); |
1162 | 1162 | } |
1163 | 1163 |
|
1164 | 1164 | void IndexOfBuffer(const FunctionCallbackInfo<Value>& args) { |
@@ -1246,14 +1246,14 @@ void IndexOfBuffer(const FunctionCallbackInfo<Value>& args) { |
1246 | 1246 | } |
1247 | 1247 |
|
1248 | 1248 | args.GetReturnValue().Set(result >= search_end ? -1 |
1249 | | - : static_cast<int>(result)); |
| 1249 | + : static_cast<double>(result)); |
1250 | 1250 | } |
1251 | 1251 |
|
1252 | | -int32_t IndexOfNumberImpl(Local<Value> buffer_obj, |
1253 | | - const uint32_t needle, |
1254 | | - const int64_t offset_i64, |
1255 | | - const int64_t end_i64, |
1256 | | - const bool is_forward) { |
| 1252 | +double IndexOfNumberImpl(Local<Value> buffer_obj, |
| 1253 | + const uint32_t needle, |
| 1254 | + const int64_t offset_i64, |
| 1255 | + const int64_t end_i64, |
| 1256 | + const bool is_forward) { |
1257 | 1257 | ArrayBufferViewContents<uint8_t> buffer(buffer_obj); |
1258 | 1258 | const uint8_t* buffer_data = buffer.data(); |
1259 | 1259 | const size_t buffer_length = buffer.length(); |
@@ -1276,7 +1276,7 @@ int32_t IndexOfNumberImpl(Local<Value> buffer_obj, |
1276 | 1276 | ptr = nbytes::stringsearch::MemrchrFill(buffer_data, needle, backward_end); |
1277 | 1277 | } |
1278 | 1278 | const uint8_t* ptr_uint8 = static_cast<const uint8_t*>(ptr); |
1279 | | - return ptr != nullptr ? static_cast<int32_t>(ptr_uint8 - buffer_data) : -1; |
| 1279 | + return ptr != nullptr ? static_cast<double>(ptr_uint8 - buffer_data) : -1; |
1280 | 1280 | } |
1281 | 1281 |
|
1282 | 1282 | void SlowIndexOfNumber(const FunctionCallbackInfo<Value>& args) { |
@@ -1297,14 +1297,14 @@ void SlowIndexOfNumber(const FunctionCallbackInfo<Value>& args) { |
1297 | 1297 | IndexOfNumberImpl(buffer_obj, needle, offset_i64, end_i64, is_forward)); |
1298 | 1298 | } |
1299 | 1299 |
|
1300 | | -int32_t FastIndexOfNumber(Local<Value>, |
1301 | | - Local<Value> buffer_obj, |
1302 | | - uint32_t needle, |
1303 | | - int64_t offset_i64, |
1304 | | - bool is_forward, |
1305 | | - int64_t end_i64, |
1306 | | - // NOLINTNEXTLINE(runtime/references) |
1307 | | - FastApiCallbackOptions& options) { |
| 1300 | +double FastIndexOfNumber(Local<Value>, |
| 1301 | + Local<Value> buffer_obj, |
| 1302 | + uint32_t needle, |
| 1303 | + int64_t offset_i64, |
| 1304 | + bool is_forward, |
| 1305 | + int64_t end_i64, |
| 1306 | + // NOLINTNEXTLINE(runtime/references) |
| 1307 | + FastApiCallbackOptions& options) { |
1308 | 1308 | HandleScope scope(options.isolate); |
1309 | 1309 | return IndexOfNumberImpl(buffer_obj, needle, offset_i64, end_i64, is_forward); |
1310 | 1310 | } |
|