mirror of
https://github.com/verilator/verilator.git
synced 2025-05-02 05:26:53 +00:00
C++11: Use delegating constructors. No functional change.
This commit is contained in:
parent
c0127599df
commit
ea4031cbd3
@ -7669,24 +7669,17 @@ public:
|
||||
class AstReplicate : public AstNodeBiop {
|
||||
// Also used as a "Uniop" flavor of Concat, e.g. "{a}"
|
||||
// Verilog {rhs{lhs}} - Note rhsp() is the replicate value, not the lhsp()
|
||||
private:
|
||||
void init() {
|
||||
if (lhsp()) {
|
||||
if (const AstConst* constp = VN_CAST(rhsp(), Const)) {
|
||||
dtypeSetLogicSized(lhsp()->width() * constp->toUInt(), VSigning::UNSIGNED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
AstReplicate(FileLine* fl, AstNode* lhsp, AstNode* rhsp)
|
||||
: ASTGEN_SUPER(fl, lhsp, rhsp) {
|
||||
init();
|
||||
if (lhsp) {
|
||||
if (const AstConst* constp = VN_CAST(rhsp, Const)) {
|
||||
dtypeSetLogicSized(lhsp->width() * constp->toUInt(), VSigning::UNSIGNED);
|
||||
}
|
||||
}
|
||||
}
|
||||
AstReplicate(FileLine* fl, AstNode* lhsp, uint32_t repCount)
|
||||
: ASTGEN_SUPER(fl, lhsp, new AstConst(fl, repCount)) {
|
||||
init();
|
||||
}
|
||||
: AstReplicate(fl, lhsp, new AstConst(fl, repCount)) {}
|
||||
ASTNODE_NODE_FUNCS(Replicate)
|
||||
virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) {
|
||||
return new AstReplicate(this->fileline(), lhsp, rhsp);
|
||||
@ -7705,18 +7698,13 @@ public:
|
||||
};
|
||||
class AstReplicateN : public AstNodeBiop {
|
||||
// String replicate
|
||||
private:
|
||||
void init() { dtypeSetString(); }
|
||||
|
||||
public:
|
||||
AstReplicateN(FileLine* fl, AstNode* lhsp, AstNode* rhsp)
|
||||
: ASTGEN_SUPER(fl, lhsp, rhsp) {
|
||||
init();
|
||||
dtypeSetString();
|
||||
}
|
||||
AstReplicateN(FileLine* fl, AstNode* lhsp, uint32_t repCount)
|
||||
: ASTGEN_SUPER(fl, lhsp, new AstConst(fl, repCount)) {
|
||||
init();
|
||||
}
|
||||
: AstReplicateN(fl, lhsp, new AstConst(fl, repCount)) {}
|
||||
ASTNODE_NODE_FUNCS(ReplicateN)
|
||||
virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) {
|
||||
return new AstReplicateN(this->fileline(), lhsp, rhsp);
|
||||
|
@ -116,9 +116,20 @@ class VHashSha256 {
|
||||
size_t m_totLength; // Total all-chunk length as needed by output digest
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
VHashSha256() { init(); }
|
||||
explicit VHashSha256(const string& data) {
|
||||
init();
|
||||
VHashSha256() {
|
||||
m_inthash[0] = 0x6a09e667;
|
||||
m_inthash[1] = 0xbb67ae85;
|
||||
m_inthash[2] = 0x3c6ef372;
|
||||
m_inthash[3] = 0xa54ff53a;
|
||||
m_inthash[4] = 0x510e527f;
|
||||
m_inthash[5] = 0x9b05688c;
|
||||
m_inthash[6] = 0x1f83d9ab;
|
||||
m_inthash[7] = 0x5be0cd19;
|
||||
m_final = false;
|
||||
m_totLength = 0;
|
||||
}
|
||||
explicit VHashSha256(const string& data)
|
||||
: VHashSha256() {
|
||||
insert(data);
|
||||
}
|
||||
~VHashSha256() {}
|
||||
@ -138,18 +149,6 @@ public:
|
||||
void insert(uint64_t value) { insert(cvtToStr(value)); }
|
||||
|
||||
private:
|
||||
void init() {
|
||||
m_inthash[0] = 0x6a09e667;
|
||||
m_inthash[1] = 0xbb67ae85;
|
||||
m_inthash[2] = 0x3c6ef372;
|
||||
m_inthash[3] = 0xa54ff53a;
|
||||
m_inthash[4] = 0x510e527f;
|
||||
m_inthash[5] = 0x9b05688c;
|
||||
m_inthash[6] = 0x1f83d9ab;
|
||||
m_inthash[7] = 0x5be0cd19;
|
||||
m_final = false;
|
||||
m_totLength = 0;
|
||||
}
|
||||
static void selfTestOne(const string& data, const string& data2, const string& exp,
|
||||
const string& exp64);
|
||||
void finalize(); // Process remaining data
|
||||
|
Loading…
Reference in New Issue
Block a user