rice 4.3.2 → 4.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/include/rice/rice.hpp +9 -19
- data/lib/version.rb +1 -1
- data/rice/detail/NativeRegistry.hpp +1 -3
- data/rice/detail/NativeRegistry.ipp +8 -16
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20166e7dba31a0e143cdc5a0be57c36a61ae93975ff2aaefbb1682e55382a40d
|
4
|
+
data.tar.gz: dff13c1a5eb9ea2672754cd30ddcd817d7865c497f6869f34dc920cfb3d0f111
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4afced2db4bb7f4b5eb2520a5a0d297acf74a738ae2932225ecf2be9c10348cb426252c40f0204f651389d5823aae996065278262101685a2f64e65c0e2472e8
|
7
|
+
data.tar.gz: 8c2293c0d4159954e7640c148865b51e8263c02ce7b35c3a18d4b5b56c35c853007b8b88799265ab4f389455006fa179a089888791c6c6d88f79a85d95f448fe
|
data/CHANGELOG.md
CHANGED
data/include/rice/rice.hpp
CHANGED
@@ -1075,7 +1075,6 @@ namespace Rice::detail
|
|
1075
1075
|
|
1076
1076
|
#include <unordered_map>
|
1077
1077
|
#include <any>
|
1078
|
-
#include <tuple>
|
1079
1078
|
|
1080
1079
|
|
1081
1080
|
namespace Rice::detail
|
@@ -1094,8 +1093,7 @@ namespace Rice::detail
|
|
1094
1093
|
Return_T lookup(VALUE klass, ID method_id);
|
1095
1094
|
|
1096
1095
|
private:
|
1097
|
-
|
1098
|
-
std::unordered_multimap<size_t, std::tuple<VALUE, ID, std::any>> natives_ = {};
|
1096
|
+
std::unordered_multimap<ID, std::pair<VALUE, std::any>> natives_ = {};
|
1099
1097
|
};
|
1100
1098
|
}
|
1101
1099
|
|
@@ -1111,14 +1109,6 @@ namespace Rice::detail
|
|
1111
1109
|
|
1112
1110
|
namespace Rice::detail
|
1113
1111
|
{
|
1114
|
-
// Effective Java (2nd edition)
|
1115
|
-
// https://stackoverflow.com/a/2634715
|
1116
|
-
inline size_t NativeRegistry::key(VALUE klass, ID id)
|
1117
|
-
{
|
1118
|
-
uint32_t prime = 53;
|
1119
|
-
return (prime + klass) * prime + id;
|
1120
|
-
}
|
1121
|
-
|
1122
1112
|
inline void NativeRegistry::add(VALUE klass, ID method_id, std::any callable)
|
1123
1113
|
{
|
1124
1114
|
if (rb_type(klass) == T_ICLASS)
|
@@ -1126,19 +1116,19 @@ namespace Rice::detail
|
|
1126
1116
|
klass = detail::protect(rb_class_of, klass);
|
1127
1117
|
}
|
1128
1118
|
|
1129
|
-
auto range = this->natives_.equal_range(
|
1119
|
+
auto range = this->natives_.equal_range(method_id);
|
1130
1120
|
for (auto it = range.first; it != range.second; ++it)
|
1131
1121
|
{
|
1132
|
-
const auto [k,
|
1122
|
+
const auto [k, d] = it->second;
|
1133
1123
|
|
1134
|
-
if (k == klass
|
1124
|
+
if (k == klass)
|
1135
1125
|
{
|
1136
|
-
std::get<
|
1126
|
+
std::get<1>(it->second) = callable;
|
1137
1127
|
return;
|
1138
1128
|
}
|
1139
1129
|
}
|
1140
1130
|
|
1141
|
-
this->natives_.emplace(std::make_pair(
|
1131
|
+
this->natives_.emplace(std::make_pair(method_id, std::make_pair(klass, callable)));
|
1142
1132
|
}
|
1143
1133
|
|
1144
1134
|
template <typename Return_T>
|
@@ -1162,12 +1152,12 @@ namespace Rice::detail
|
|
1162
1152
|
klass = detail::protect(rb_class_of, klass);
|
1163
1153
|
}
|
1164
1154
|
|
1165
|
-
auto range = this->natives_.equal_range(
|
1155
|
+
auto range = this->natives_.equal_range(method_id);
|
1166
1156
|
for (auto it = range.first; it != range.second; ++it)
|
1167
1157
|
{
|
1168
|
-
const auto [k,
|
1158
|
+
const auto [k, d] = it->second;
|
1169
1159
|
|
1170
|
-
if (k == klass
|
1160
|
+
if (k == klass)
|
1171
1161
|
{
|
1172
1162
|
auto* ptr = std::any_cast<Return_T>(&d);
|
1173
1163
|
if (!ptr)
|
data/lib/version.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
|
4
4
|
#include <unordered_map>
|
5
5
|
#include <any>
|
6
|
-
#include <tuple>
|
7
6
|
|
8
7
|
#include "ruby.hpp"
|
9
8
|
|
@@ -23,8 +22,7 @@ namespace Rice::detail
|
|
23
22
|
Return_T lookup(VALUE klass, ID method_id);
|
24
23
|
|
25
24
|
private:
|
26
|
-
|
27
|
-
std::unordered_multimap<size_t, std::tuple<VALUE, ID, std::any>> natives_ = {};
|
25
|
+
std::unordered_multimap<ID, std::pair<VALUE, std::any>> natives_ = {};
|
28
26
|
};
|
29
27
|
}
|
30
28
|
#include "NativeRegistry.ipp"
|
@@ -10,14 +10,6 @@
|
|
10
10
|
|
11
11
|
namespace Rice::detail
|
12
12
|
{
|
13
|
-
// Effective Java (2nd edition)
|
14
|
-
// https://stackoverflow.com/a/2634715
|
15
|
-
inline size_t NativeRegistry::key(VALUE klass, ID id)
|
16
|
-
{
|
17
|
-
uint32_t prime = 53;
|
18
|
-
return (prime + klass) * prime + id;
|
19
|
-
}
|
20
|
-
|
21
13
|
inline void NativeRegistry::add(VALUE klass, ID method_id, std::any callable)
|
22
14
|
{
|
23
15
|
if (rb_type(klass) == T_ICLASS)
|
@@ -25,19 +17,19 @@ namespace Rice::detail
|
|
25
17
|
klass = detail::protect(rb_class_of, klass);
|
26
18
|
}
|
27
19
|
|
28
|
-
auto range = this->natives_.equal_range(
|
20
|
+
auto range = this->natives_.equal_range(method_id);
|
29
21
|
for (auto it = range.first; it != range.second; ++it)
|
30
22
|
{
|
31
|
-
const auto [k,
|
23
|
+
const auto [k, d] = it->second;
|
32
24
|
|
33
|
-
if (k == klass
|
25
|
+
if (k == klass)
|
34
26
|
{
|
35
|
-
std::get<
|
27
|
+
std::get<1>(it->second) = callable;
|
36
28
|
return;
|
37
29
|
}
|
38
30
|
}
|
39
31
|
|
40
|
-
this->natives_.emplace(std::make_pair(
|
32
|
+
this->natives_.emplace(std::make_pair(method_id, std::make_pair(klass, callable)));
|
41
33
|
}
|
42
34
|
|
43
35
|
template <typename Return_T>
|
@@ -61,12 +53,12 @@ namespace Rice::detail
|
|
61
53
|
klass = detail::protect(rb_class_of, klass);
|
62
54
|
}
|
63
55
|
|
64
|
-
auto range = this->natives_.equal_range(
|
56
|
+
auto range = this->natives_.equal_range(method_id);
|
65
57
|
for (auto it = range.first; it != range.second; ++it)
|
66
58
|
{
|
67
|
-
const auto [k,
|
59
|
+
const auto [k, d] = it->second;
|
68
60
|
|
69
|
-
if (k == klass
|
61
|
+
if (k == klass)
|
70
62
|
{
|
71
63
|
auto* ptr = std::any_cast<Return_T>(&d);
|
72
64
|
if (!ptr)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.3.
|
4
|
+
version: 4.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Brannan
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2024-10-
|
13
|
+
date: 2024-10-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|