Skip to content

Commit 582d1c5

Browse files
committed
fix typo ByteBuffer::Type::KFloat32 -> ByteBuffer::Type::kFloat32
1 parent 6161f78 commit 582d1c5

File tree

8 files changed

+22
-12
lines changed

8 files changed

+22
-12
lines changed

backend/JavaScriptCore/JscLocalReference.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ ByteBuffer::Type mapType(JSTypedArrayType type) {
501501
case kJSTypedArrayTypeUint32Array:
502502
return ByteBuffer::Type::kUint32;
503503
case kJSTypedArrayTypeFloat32Array:
504-
return ByteBuffer::Type::KFloat32;
504+
return ByteBuffer::Type::kFloat32;
505505
case kJSTypedArrayTypeFloat64Array:
506506
return ByteBuffer::Type::kFloat64;
507507
case kJSTypedArrayTypeArrayBuffer:

backend/QuickJs/QjsEngine.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ constexpr auto kGetByteBufferInfo = R"(
3737
const kUint32 = 0x604;
3838
const kInt64 = 0x708;
3939
const kUint64 = 0x808;
40-
const KFloat32 = 0x904;
40+
const kFloat32 = 0x904;
4141
const kFloat64 = 0xa08;
4242
4343
let byteBuffer = val;
@@ -64,7 +64,7 @@ constexpr auto kGetByteBufferInfo = R"(
6464
} else if (val instanceof Uint32Array) {
6565
type = kUint32;
6666
} else if (val instanceof Float32Array) {
67-
type = KFloat32;
67+
type = kFloat32;
6868
} else if (val instanceof Float64Array) {
6969
type = kFloat64;
7070
} else if (val instanceof BigInt64Array) {

backend/Template/TemplateLocalReference.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ void Local<Array>::add(const script::Local<script::Value>& value) const { set(si
199199

200200
void Local<Array>::clear() const {}
201201

202-
ByteBuffer::Type Local<ByteBuffer>::getType() const { return ByteBuffer::Type::KFloat32; }
202+
ByteBuffer::Type Local<ByteBuffer>::getType() const { return ByteBuffer::Type::kFloat32; }
203203

204204
bool Local<ByteBuffer>::isShared() const { return true; }
205205

backend/V8/V8LocalReference.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ ByteBuffer::Type Local<ByteBuffer>::getType() const {
378378
} else if (val_->IsBigUint64Array()) {
379379
return ByteBuffer::Type::kUint64;
380380
} else if (val_->IsFloat32Array()) {
381-
return ByteBuffer::Type::KFloat32;
381+
return ByteBuffer::Type::kFloat32;
382382
} else if (val_->IsFloat64Array()) {
383383
return ByteBuffer::Type::kFloat64;
384384
}

backend/WebAssembly/WasmHelper.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,7 @@ CHECKED_EM_JS(void, _ScriptX_ByteBuffer_fillTypeAndSize,
873873
const kUint32 = 0x604;
874874
const kInt64 = 0x708;
875875
const kUint64 = 0x808;
876-
const KFloat32 = 0x904;
876+
const kFloat32 = 0x904;
877877
const kFloat64 = 0xa08;
878878

879879
let type = kUnspecified;
@@ -892,7 +892,7 @@ CHECKED_EM_JS(void, _ScriptX_ByteBuffer_fillTypeAndSize,
892892
} else if (val instanceof Uint32Array) {
893893
type = kUint32;
894894
} else if (val instanceof Float32Array) {
895-
type = KFloat32;
895+
type = kFloat32;
896896
} else if (val instanceof Float64Array) {
897897
type = kFloat64;
898898
} else if (val instanceof BigInt64Array) {

src/Value.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ class ByteBuffer : public Value {
282282
kUint32 = internal::makeType(6, 4),
283283
kInt64 = internal::makeType(7, 8),
284284
kUint64 = internal::makeType(8, 8),
285-
KFloat32 = internal::makeType(9, 4),
285+
kFloat32 = internal::makeType(9, 4),
286286
kFloat64 = internal::makeType(10, 8)
287287
};
288288

test/src/ByteBufferTest.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ TEST_F(ByteBufferTest, DataView) {
136136
{"BigInt64Array", ByteBuffer::Type::kInt64},
137137
{"BigUint64Array", ByteBuffer::Type::kUint64},
138138
#endif
139-
{"Float32Array", ByteBuffer::Type::KFloat32},
139+
{"Float32Array", ByteBuffer::Type::kFloat32},
140140
{"Float64Array", ByteBuffer::Type::kFloat64},
141141
{"DataView", ByteBuffer::Type::kUnspecified}}) {
142142
std::ostringstream code;

test/src/ThreadPoolTest.cc

+13-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
#include <array>
1919
#include <atomic>
20+
#include <cmath>
2021
#include <iomanip>
2122
#include "test.h"
2223

@@ -74,8 +75,6 @@ TEST(ThreadPool, MultiThreadRun) {
7475
EXPECT_EQ(max * kProducerCount, i->load());
7576
}
7677

77-
static constexpr auto kEnableMultiThreadTest = true;
78-
7978
template <size_t kProducerThreads, size_t kWorkerThreads>
8079
void runThreadpoolBenchmark() {
8180
using std::chrono::duration;
@@ -85,7 +84,8 @@ void runThreadpoolBenchmark() {
8584
using std::chrono::steady_clock;
8685
using std::chrono_literals::operator""ms;
8786

88-
constexpr auto kRunTimeMs = 1000ms;
87+
constexpr auto kEnableMultiThreadTest = false;
88+
constexpr auto kRunTimeMs = 200ms;
8989

9090
// simple benchmark
9191
if (!kEnableMultiThreadTest) return;
@@ -101,6 +101,16 @@ void runThreadpoolBenchmark() {
101101

102102
tp.postMessage(stopMsg, kRunTimeMs);
103103

104+
auto handleMessage = [](Message& msg) {
105+
auto* i = static_cast<std::atomic_int64_t*>(msg.ptr0);
106+
for (int j = 0; j < 100 * 1000; ++j) {
107+
// do a bit havey work
108+
auto x = sinf(i->load());
109+
static_cast<void>(x);
110+
}
111+
(*i)++;
112+
};
113+
104114
std::array<std::unique_ptr<std::thread>, kProducerThreads> p;
105115
for (auto& t : p) {
106116
t = std::make_unique<std::thread>([&]() {

0 commit comments

Comments
 (0)