Skip to content

Commit

Permalink
Remove remaining fixed-size ints from Yuni (#1629)
Browse files Browse the repository at this point in the history
  • Loading branch information
flomnes authored Sep 19, 2023
1 parent ebc2f13 commit 948c9c9
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 55 deletions.
2 changes: 1 addition & 1 deletion src/ext/yuni/src/yuni/core/color/rgb.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace Color
** \brief 32Bits RGB Color Model (additive color model + transparency)
** \ingroup Color
*/
template<class T = uint8>
template<class T = uint8_t>
class YUNI_DECL RGB final
{
public:
Expand Down
4 changes: 2 additions & 2 deletions src/ext/yuni/src/yuni/core/getopt/option.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,10 @@ class Flag<int64_t>
};

template<>
class Flag<uint16>
class Flag<uint16_t>
{
public:
static void Enable(uint16& out)
static void Enable(uint16_t& out)
{
out = 1u;
}
Expand Down
15 changes: 3 additions & 12 deletions src/ext/yuni/src/yuni/core/static/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,6 @@ struct IsFundamental<bool>
};
};
template<>
struct IsFundamental<signed char>
{
enum
{
Yes = 1,
No = 0
};
};
template<>
struct IsFundamental<wchar_t>
{
enum
Expand Down Expand Up @@ -228,7 +219,7 @@ struct IsFundamental<long double>
// Signed int
#ifndef YUNI_TYPES_INT8_CHAR_ARE_IDENTICAL
template<>
struct IsFundamental<sint8>
struct IsFundamental<int8_t>
{
enum
{
Expand Down Expand Up @@ -267,7 +258,7 @@ struct IsFundamental<int64_t>
// Unsigned int
#ifndef YUNI_TYPES_INT8_CHAR_ARE_IDENTICAL
template<>
struct IsFundamental<uint8>
struct IsFundamental<uint8_t>
{
enum
{
Expand All @@ -276,7 +267,7 @@ struct IsFundamental<uint8>
};
};
template<>
struct IsFundamental<uint16>
struct IsFundamental<uint16_t>
{
enum
{
Expand Down
31 changes: 0 additions & 31 deletions src/ext/yuni/src/yuni/core/system/stdint.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,6 @@

namespace Yuni
{
/*! 64-bit unsigned int, guaranteed to be 8 bytes in size */
typedef uint64_t uint64_t;
/*! 64-bit unsigned int, guaranteed to be 8 bytes in size */
typedef int64_t int64_t;
/*! 32-bit unsigned int, guaranteed to be 4 bytes in size */
typedef uint32_t uint32_t;
/*! 32-bit unsigned int, guaranteed to be 4 bytes in size */
typedef int32_t int32_t;
/*! 16-bit unsigned int, guaranteed to be 2 bytes in size */
typedef uint16_t uint16;
/*! 16-bit unsigned int, guaranteed to be 2 bytes in size */
typedef int16_t int16_t;
/*! 8-bit unsigned int, guaranteed to be 1 byte in size */
typedef unsigned char uint8;
/*! 8-bit unsigned int, guaranteed to be 1 byte in size */
typedef char sint8;

/*! unsigned char */
typedef unsigned char uchar;

Expand All @@ -64,12 +47,6 @@ static const uint64_t AutoDetectNullChar = static_cast<uint64_t>(-1);
/*! ssize_t */
typedef int64_t ssize_t;
#endif

/*! Decimal floating-point (32 bits) */
typedef float float32;
/*! Decimal floating-point (32 bits) */
typedef double float64;

} /* namespace Yuni */

#else /* Actually we have a C Compiler */
Expand All @@ -78,14 +55,6 @@ typedef double float64;

#endif /* C++ Compiler */

/* C types */

// TODO REMOVE THIS GARBAGE
/*! Decimal floating-point (32 bits) */
typedef float yfloat32;
/*! Decimal floating-point (32 bits) */
typedef double yfloat64;

/* Both C / C++ compiler */

#ifndef YUNI_HAS_UINT
Expand Down
4 changes: 2 additions & 2 deletions src/ext/yuni/src/yuni/io/file/stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ class Stream final : private NonCopyable<Stream>
//! Write an interger
uint write(int64_t value);
//! Write an interger
uint write(uint16 value);
uint write(uint16_t value);
//! Write an interger
uint write(uint32_t value);
//! Write an interger
Expand Down Expand Up @@ -341,7 +341,7 @@ class Stream final : private NonCopyable<Stream>
//! Write an interger
uint write(int64_t value, uint64_t maxsize);
//! Write an interger
uint write(uint16 value, uint64_t maxsize);
uint write(uint16_t value, uint64_t maxsize);
//! Write an interger
uint write(uint32_t value, uint64_t maxsize);
//! Write an interger
Expand Down
4 changes: 2 additions & 2 deletions src/ext/yuni/src/yuni/io/file/stream.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ inline uint Stream::write(int64_t value, uint64_t maxsize)
pFd);
}

inline uint Stream::write(uint16 value)
inline uint Stream::write(uint16_t value)
{
ShortString32 string(value);
return (uint)::fwrite(string.c_str(), 1, string.size(), pFd);
}

inline uint Stream::write(uint16 value, uint64_t maxsize)
inline uint Stream::write(uint16_t value, uint64_t maxsize)
{
ShortString32 string(value);
return (uint)::fwrite(string.c_str(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,14 @@ void BindingConstraintsRepository::reverseWeightSign(const AreaLink* lnk)
each([&lnk](BindingConstraint &constraint) { constraint.reverseWeightSign(lnk); });
}

Yuni::uint64_t BindingConstraintsRepository::memoryUsage() const
uint64_t BindingConstraintsRepository::memoryUsage() const
{
Yuni::uint64_t m = sizeof(BindingConstraintsRepository);
uint64_t m = sizeof(BindingConstraintsRepository);
for (const auto & i : constraints_)
m += i->memoryUsage();
return m;
}


namespace // anonymous
{
template<class T>
Expand Down
4 changes: 2 additions & 2 deletions src/ui/simulator/windows/output/panel/area-link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,10 +566,10 @@ class JobAggregator : public Yuni::Job::IJob, public Yuni::IEventObserver<JobAgg
std::vector<bool> colRowCaption;
// The result matrix
Matrix<double> ops;
Matrix<uint8> cellStatus;
Matrix<uint8_t> cellStatus;
MatrixType headerColumns;
MatrixType headerRows;
std::vector<uint8> precision;
std::vector<uint8_t> precision;
}; // class JobAggregator

class DataAreaOrLink : public Panel::IData
Expand Down

0 comments on commit 948c9c9

Please sign in to comment.