forked from Abc-Arbitrage/Disruptor-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOperation.cpp
More file actions
31 lines (26 loc) · 750 Bytes
/
Copy pathOperation.cpp
File metadata and controls
31 lines (26 loc) · 750 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "stdafx.h"
#include "Operation.h"
#include "Disruptor/ArgumentOutOfRangeException.h"
namespace Disruptor
{
namespace PerfTests
{
namespace OperationExtensions
{
std::int64_t Op(Operation operation, std::int64_t lhs, std::int64_t rhs)
{
switch (operation)
{
case Operation::Addition:
return lhs + rhs;
case Operation::Subtraction:
return lhs - rhs;
case Operation::And:
return lhs & rhs;
default:
DISRUPTOR_THROW_ARGUMENT_OUT_OF_RANGE_EXCEPTION("The variable 'operation' (" << static_cast< int >(operation) << ") is out of range");
}
}
} // namespace OperationExtensions
} // namespace PerfTests
} // namespace Disruptor