Skip to content

Commit

Permalink
Merge pull request #384 from OutpostUniverse/GlobalNamespaceTry2
Browse files Browse the repository at this point in the history
Global namespace try2
  • Loading branch information
DanRStevens authored Jan 28, 2021
2 parents 1ee3394 + 9c72491 commit 98d806b
Show file tree
Hide file tree
Showing 115 changed files with 2,144 additions and 1,968 deletions.
2 changes: 1 addition & 1 deletion src/Archive/AdaptiveHuffmanTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <string>
#include <stdexcept>

namespace Archive
namespace OP2Utility::Archive
{
// Creates an (adaptive) Huffman tree with terminalNodeCount at the bottom.
AdaptiveHuffmanTree::AdaptiveHuffmanTree(NodeType terminalNodeCount) :
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/AdaptiveHuffmanTree.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <vector>

namespace Archive
namespace OP2Utility::Archive
{
// The Huffman Tree stores codes in the terminal nodes of the (binary) tree.
// The tree is initially balanced with codes 0 to terminalNodeCount-1 in the
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/ArchiveFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <string>
#include <stdexcept>

namespace Archive
namespace OP2Utility::Archive
{
ArchiveFile::ArchiveFile(const std::string& filename) :
m_ArchiveFilename(filename), m_Count(0), m_ArchiveFileSize(0) { }
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/ArchiveFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <cstdint>
#include <cstddef>

namespace Archive
namespace OP2Utility::Archive
{
class ArchiveFile
{
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/BitStreamReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <string>
#include <limits>

namespace Archive
namespace OP2Utility::Archive
{
BitStreamReader::BitStreamReader(void *buffer, std::size_t bufferSize) :
m_BufferBitSize(bufferSize << 3),
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/BitStreamReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <cstddef>

namespace Archive
namespace OP2Utility::Archive
{
// This is designed for use in the .vol file decompressor
class BitStreamReader
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/ClmFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <stdexcept>
#include <algorithm>

namespace Archive
namespace OP2Utility::Archive
{
ClmFile::ClmFile(const std::string& filename) : ArchiveFile(filename), clmFileReader(filename)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/ClmFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <array>
#include <memory>

namespace Archive
namespace OP2Utility::Archive
{
class ClmFile : public ArchiveFile
{
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/CompressionType.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <cstdint>

namespace Archive
namespace OP2Utility::Archive
{
// Represents compression flags used by Outpost 2 .VOL files to compress files
// See FileFormat Archive Vol.txt for more details
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/HuffLZ.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "HuffLZ.h"
#include <cstring>

namespace Archive
namespace OP2Utility::Archive
{
// Constructs the object around an existing bit stream
HuffLZ::HuffLZ(const BitStreamReader& bitStream) :
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/HuffLZ.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "BitStreamReader.h"
#include <cstddef>

namespace Archive
namespace OP2Utility::Archive
{
class HuffLZ
{
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/VolFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <climits>
#include <typeinfo>

namespace Archive
namespace OP2Utility::Archive
{
// Volume section header tags
constexpr auto TagVOL_ = MakeTag("VOL "); // Volume file tag
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/VolFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <array>
#include <memory>

namespace Archive
namespace OP2Utility::Archive
{
class VolFile : public ArchiveFile
{
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/WaveFile.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "WaveFile.h"

namespace Archive
namespace OP2Utility::Archive
{
WaveHeader WaveHeader::Create(const WaveFormatEx& waveFormat, uint32_t dataLength)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Archive/WaveFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <array>
#include <cstdint>

namespace Archive
namespace OP2Utility::Archive
{
constexpr auto tagRIFF = MakeTag("RIFF");
constexpr auto tagWAVE = MakeTag("WAVE");
Expand Down
26 changes: 14 additions & 12 deletions src/BitTwiddle.cpp
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
#include "BitTwiddle.h"


bool IsPowerOf2(uint32_t value)
namespace OP2Utility
{
return value && !(value & (value - 1));
}
bool IsPowerOf2(uint32_t value)
{
return value && !(value & (value - 1));
}

// This method assumes the argument is a power of 2
uint32_t Log2OfPowerOf2(uint32_t value)
{
static const int MultiplyDeBruijnBitPosition2[32] =
// This method assumes the argument is a power of 2
uint32_t Log2OfPowerOf2(uint32_t value)
{
0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
};
return MultiplyDeBruijnBitPosition2[static_cast<uint32_t>(value * 0x077CB531U) >> 27];
static const int MultiplyDeBruijnBitPosition2[32] =
{
0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
};
return MultiplyDeBruijnBitPosition2[static_cast<uint32_t>(value * 0x077CB531U) >> 27];
}
}
7 changes: 5 additions & 2 deletions src/BitTwiddle.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@

#include <cstdint>

bool IsPowerOf2(uint32_t value);
uint32_t Log2OfPowerOf2(uint32_t value);
namespace OP2Utility
{
bool IsPowerOf2(uint32_t value);
uint32_t Log2OfPowerOf2(uint32_t value);
}
Loading

0 comments on commit 98d806b

Please sign in to comment.