-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
dsplib/assert.h
header. Remove dsplib/throw.h
.
- Loading branch information
Showing
18 changed files
with
50 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#pragma once | ||
|
||
#include <dsplib/defs.h> | ||
#include <cassert> | ||
|
||
#ifdef DSPLIB_NO_EXCEPTIONS | ||
|
||
#include <iostream> | ||
|
||
//TODO: add filename to message | ||
#define DSPLIB_THROW(MSG) \ | ||
std::cerr << (std::string("dsplib: ") + MSG) << std::endl; \ | ||
std::abort(); | ||
|
||
#else | ||
|
||
#include <stdexcept> | ||
|
||
#define DSPLIB_THROW(MSG) throw std::runtime_error(std::string("dsplib: ") + MSG); | ||
|
||
#endif | ||
|
||
#define DSPLIB_ASSERT(condition, message) \ | ||
if (!(condition)) { \ | ||
DSPLIB_THROW(message); \ | ||
} | ||
|
||
#ifdef _MSC_VER | ||
#define DSPLIB_ASSUME(cond) \ | ||
assert(cond); \ | ||
__assume(cond); | ||
#elif defined(__clang__) | ||
#define DSPLIB_ASSUME(cond) \ | ||
assert(cond); \ | ||
__builtin_assume(cond) | ||
#elif defined(__GNUC__) | ||
#define DSPLIB_ASSUME(cond) \ | ||
assert(cond); \ | ||
((cond) ? static_cast<void>(0) : __builtin_unreachable()); | ||
#else | ||
#define DSPLIB_ASSUME(cond) \ | ||
assert(cond); \ | ||
static_cast<void>((cond) ? 0 : 0); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#include "dsplib/resample.h" | ||
#include "dsplib/throw.h" | ||
|
||
namespace dsplib { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
#include "dsplib/resample.h" | ||
#include "dsplib/throw.h" | ||
|
||
#include <cassert> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters