Skip to content

Commit e6c16f6

Browse files
committed
avoid new to make it compatible with CUDA
1 parent 3a019e3 commit e6c16f6

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

include/cloudkey.hpp

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -102,23 +102,19 @@ struct EvalKey {
102102
void emplacebkfft(const SecretKey& sk)
103103
{
104104
if constexpr (std::is_same_v<P, lvl01param>) {
105-
bkfftlvl01 = std::unique_ptr<BootstrappingKeyFFT<lvl01param>>(
106-
new (std::align_val_t(64)) BootstrappingKeyFFT<lvl01param>());
105+
bkfftlvl01 = std::make_unique<BootstrappingKeyFFT<lvl01param>>();
107106
bkfftgen<lvl01param>(*bkfftlvl01, sk);
108107
}
109108
else if constexpr (std::is_same_v<P, lvlh1param>) {
110-
bkfftlvlh1 = std::unique_ptr<BootstrappingKeyFFT<lvlh1param>>(
111-
new (std::align_val_t(64)) BootstrappingKeyFFT<lvlh1param>());
109+
bkfftlvlh1 = std::make_unique<BootstrappingKeyFFT<lvlh1param>>();
112110
bkfftgen<lvlh1param>(*bkfftlvlh1, sk);
113111
}
114112
else if constexpr (std::is_same_v<P, lvl02param>) {
115-
bkfftlvl02 = std::unique_ptr<BootstrappingKeyFFT<lvl02param>>(
116-
new (std::align_val_t(64)) BootstrappingKeyFFT<lvl02param>());
113+
bkfftlvl02 = std::make_unique<BootstrappingKeyFFT<lvl02param>>();
117114
bkfftgen<lvl02param>(*bkfftlvl02, sk);
118115
}
119116
else if constexpr (std::is_same_v<P, lvlh2param>) {
120-
bkfftlvlh2 = std::unique_ptr<BootstrappingKeyFFT<lvlh2param>>(
121-
new (std::align_val_t(64)) BootstrappingKeyFFT<lvlh2param>());
117+
bkfftlvlh2 = std::make_unique<BootstrappingKeyFFT<lvlh2param>>();
122118
bkfftgen<lvlh2param>(*bkfftlvlh2, sk);
123119
}
124120
else
@@ -218,18 +214,15 @@ struct EvalKey {
218214
void emplaceiksk(const SecretKey& sk)
219215
{
220216
if constexpr (std::is_same_v<P, lvl10param>) {
221-
iksklvl10 = std::unique_ptr<KeySwitchingKey<lvl10param>>(
222-
new (std::align_val_t(64)) KeySwitchingKey<lvl10param>());
217+
iksklvl10 = std::make_unique<KeySwitchingKey<lvl10param>>();
223218
ikskgen<lvl10param>(*iksklvl10, sk);
224219
}
225220
else if constexpr (std::is_same_v<P, lvl1hparam>) {
226-
iksklvl1h = std::unique_ptr<KeySwitchingKey<lvl1hparam>>(
227-
new (std::align_val_t(64)) KeySwitchingKey<lvl1hparam>());
221+
iksklvl1h = std::make_unique<KeySwitchingKey<lvl1hparam>>();
228222
ikskgen<lvl1hparam>(*iksklvl1h, sk);
229223
}
230224
else if constexpr (std::is_same_v<P, lvl20param>) {
231-
iksklvl20 = std::unique_ptr<KeySwitchingKey<lvl20param>>(
232-
new (std::align_val_t(64)) KeySwitchingKey<lvl20param>());
225+
iksklvl20 = std::make_unique<KeySwitchingKey<lvl20param>>();
233226
ikskgen<lvl20param>(*iksklvl20, sk);
234227
}
235228
else if constexpr (std::is_same_v<P, lvl2hparam>) {
@@ -238,18 +231,15 @@ struct EvalKey {
238231
ikskgen<lvl2hparam>(*iksklvl2h, sk);
239232
}
240233
else if constexpr (std::is_same_v<P, lvl21param>) {
241-
iksklvl21 = std::unique_ptr<KeySwitchingKey<lvl21param>>(
242-
new (std::align_val_t(64)) KeySwitchingKey<lvl21param>());
234+
iksklvl21 = std::make_unique<KeySwitchingKey<lvl21param>>();
243235
ikskgen<lvl21param>(*iksklvl21, sk);
244236
}
245237
else if constexpr (std::is_same_v<P, lvl22param>) {
246-
iksklvl22 = std::unique_ptr<KeySwitchingKey<lvl22param>>(
247-
new (std::align_val_t(64)) KeySwitchingKey<lvl22param>());
238+
iksklvl22 = std::make_unique<KeySwitchingKey<lvl22param>>();
248239
ikskgen<lvl22param>(*iksklvl22, sk);
249240
}
250241
else if constexpr (std::is_same_v<P, lvl31param>) {
251-
iksklvl31 = std::unique_ptr<KeySwitchingKey<lvl31param>>(
252-
new (std::align_val_t(64)) KeySwitchingKey<lvl31param>());
242+
iksklvl31 = std::make_unique<KeySwitchingKey<lvl31param>>();
253243
ikskgen<lvl31param>(*iksklvl31, sk);
254244
}
255245
else
@@ -300,9 +290,7 @@ struct EvalKey {
300290
{
301291
if constexpr (std::is_same_v<P, lvl21param>) {
302292
subprivksklvl21[key] =
303-
std::unique_ptr<SubsetPrivateKeySwitchingKey<lvl21param>>(
304-
new (std::align_val_t(64))
305-
SubsetPrivateKeySwitchingKey<lvl21param>());
293+
std::make_unique<SubsetPrivateKeySwitchingKey<lvl21param>>();
306294
subprivkskgen<lvl21param>(*subprivksklvl21[key], func, sk);
307295
}
308296
else

0 commit comments

Comments
 (0)