mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-30 13:24:16 +01:00
core/hw/rsa: Take std::vector instances by value
Allows us to std::move them and allow calling code to eliminate copies from occurring entirely.
This commit is contained in:
parent
85d37c9994
commit
75bac1e514
@ -74,7 +74,7 @@ void InitSlots() {
|
|||||||
std::vector<u8> exponent(256);
|
std::vector<u8> exponent(256);
|
||||||
file.ReadArray(exponent.data(), exponent.size());
|
file.ReadArray(exponent.data(), exponent.size());
|
||||||
|
|
||||||
rsa_slots[0] = RsaSlot(exponent, modulus);
|
rsa_slots[0] = RsaSlot(std::move(exponent), std::move(modulus));
|
||||||
// TODO(B3N30): Initalize the other slots. But since they aren't used at all, we can skip them
|
// TODO(B3N30): Initalize the other slots. But since they aren't used at all, we can skip them
|
||||||
// for now
|
// for now
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,9 @@ namespace HW::RSA {
|
|||||||
|
|
||||||
class RsaSlot {
|
class RsaSlot {
|
||||||
public:
|
public:
|
||||||
RsaSlot() : init(false) {}
|
RsaSlot() = default;
|
||||||
RsaSlot(const std::vector<u8>& exponent, const std::vector<u8>& modulus)
|
RsaSlot(std::vector<u8> exponent, std::vector<u8> modulus)
|
||||||
: init(true), exponent(exponent), modulus(modulus) {}
|
: init(true), exponent(std::move(exponent)), modulus(std::move(modulus)) {}
|
||||||
std::vector<u8> GetSignature(const std::vector<u8>& message);
|
std::vector<u8> GetSignature(const std::vector<u8>& message);
|
||||||
|
|
||||||
operator bool() const {
|
operator bool() const {
|
||||||
@ -22,7 +22,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool init;
|
bool init = false;
|
||||||
std::vector<u8> exponent;
|
std::vector<u8> exponent;
|
||||||
std::vector<u8> modulus;
|
std::vector<u8> modulus;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user