Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base uint #348

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/ripple/sslutil/api/CBigNum.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

namespace ripple {

class uint256;

// VFALCO TODO figure out a way to remove the dependency on openssl in the
// header. Maybe rewrite this to use cryptopp.

Expand Down
77 changes: 0 additions & 77 deletions src/ripple/types/api/UInt128.h

This file was deleted.

159 changes: 1 addition & 158 deletions src/ripple/types/api/UInt160.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,164 +30,7 @@

namespace ripple {

class uint160 : public base_uint160
{
public:
typedef base_uint160 basetype;

uint160 ()
{
zero ();
}

uint160 (const basetype& b)
{
*this = b;
}

uint160& operator= (const basetype& b)
{
for (int i = 0; i < WIDTH; i++)
pn[i] = b.pn[i];

return *this;
}

explicit uint160 (std::uint64_t b)
{
*this = b;
}

uint160& operator= (std::uint64_t uHost)
{
zero ();

// Put in least significant bits.
((std::uint64_t*) end ())[-1] = htobe64 (uHost);

return *this;
}

explicit uint160 (const std::string& str)
{
SetHex (str);
}

explicit uint160 (Blob const& vch)
{
if (vch.size () == sizeof (pn))
memcpy (pn, &vch[0], sizeof (pn));
else
zero ();
}

base_uint256 to256 () const;
};

inline bool operator== (const uint160& a, std::uint64_t b)
{
return (base_uint160)a == b;
}

inline bool operator!= (const uint160& a, std::uint64_t b)
{
return (base_uint160)a != b;
}

inline const uint160 operator^ (const base_uint160& a, const base_uint160& b)
{
return uint160 (a) ^= b;
}

inline const uint160 operator& (const base_uint160& a, const base_uint160& b)
{
return uint160 (a) &= b;
}

inline const uint160 operator| (const base_uint160& a, const base_uint160& b)
{
return uint160 (a) |= b;
}

inline bool operator== (const base_uint160& a, const uint160& b)
{
return (base_uint160)a == (base_uint160)b;
}

inline bool operator!= (const base_uint160& a, const uint160& b)
{
return (base_uint160)a != (base_uint160)b;
}

inline const uint160 operator^ (const base_uint160& a, const uint160& b)
{
return (base_uint160)a ^ (base_uint160)b;
}

inline const uint160 operator& (const base_uint160& a, const uint160& b)
{
return (base_uint160)a & (base_uint160)b;
}

inline const uint160 operator| (const base_uint160& a, const uint160& b)
{
return (base_uint160)a | (base_uint160)b;
}

inline bool operator== (const uint160& a, const base_uint160& b)
{
return (base_uint160)a == (base_uint160)b;
}
inline bool operator!= (const uint160& a, const base_uint160& b)
{
return (base_uint160)a != (base_uint160)b;
}
inline const uint160 operator^ (const uint160& a, const base_uint160& b)
{
return (base_uint160)a ^ (base_uint160)b;
}

inline const uint160 operator& (const uint160& a, const base_uint160& b)
{
return (base_uint160)a & (base_uint160)b;
}

inline const uint160 operator| (const uint160& a, const base_uint160& b)
{
return (base_uint160)a | (base_uint160)b;
}

inline bool operator== (const uint160& a, const uint160& b)
{
return (base_uint160)a == (base_uint160)b;
}

inline bool operator!= (const uint160& a, const uint160& b)
{
return (base_uint160)a != (base_uint160)b;
}

inline const uint160 operator^ (const uint160& a, const uint160& b)
{
return (base_uint160)a ^ (base_uint160)b;
}

inline const uint160 operator& (const uint160& a, const uint160& b)
{
return (base_uint160)a & (base_uint160)b;
}

inline const uint160 operator| (const uint160& a, const uint160& b)
{
return (base_uint160)a | (base_uint160)b;
}

inline const std::string strHex (const uint160& ui)
{
return strHex (ui.begin (), ui.size ());
}

extern std::size_t hash_value (const uint160&);
uint256 to256 (uint160 const& a);

}

Expand Down
Loading