Skip to content

Commit

Permalink
Merge pull request #1 from heathdutton/tmp
Browse files Browse the repository at this point in the history
New Compilation
  • Loading branch information
heathdutton authored Apr 15, 2022
2 parents 75afbad + c7b3d40 commit d017c59
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ Mode Mode::leading(const char charLeading) {
return r;
}

Mode Mode::gas() {
Mode r;
r.name = "gas";
r.kernel = "profanity_score_gas";
return r;
}

Mode Mode::range(const cl_uchar min, const cl_uchar max) {
Mode r;
r.name = "range";
Expand Down
1 change: 1 addition & 0 deletions Mode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Mode {

static Mode benchmark();
static Mode zeros();
static Mode gas();
static Mode letters();
static Mode numbers();
static Mode doubles();
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ usage: ./profanity [OPTIONS]
Basic modes:
--benchmark Run without any scoring, a benchmark.
--zeros Score on zeros anywhere in hash.
--gas Score on number of zero bytes.
--letters Score on letters anywhere in hash.
--numbers Score on numbers anywhere in hash.
--mirror Score on mirroring from center.
Expand Down
1 change: 1 addition & 0 deletions help.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ usage: ./profanity [OPTIONS]
Basic modes:
--benchmark Run without any scoring, a benchmark.
--zeros Score on zeros anywhere in hash.
--gas Score on number of zero bytes.
--letters Score on letters anywhere in hash.
--numbers Score on numbers anywhere in hash.
--mirror Score on mirroring from center.
Expand Down
15 changes: 15 additions & 0 deletions profanity.cl
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,21 @@ __kernel void profanity_score_leading(__global mp_number * const pInverse, __glo
profanity_result_update(id, hash, pResult, score, scoreMax);
}

__kernel void profanity_score_gas(__global mp_number * const pInverse, __global result * const pResult, __constant const uchar * const data1, __constant const uchar * const data2, const uchar scoreMax) {
const size_t id = get_global_id(0);
__global const uchar * const hash = pInverse[id].d;
int score = 0;

if (pInverse[id].d[0] == 0) {
score = 4;
for (int i = 4; i < 20; ++i) {
score += (hash[i] == 0);
}
}

profanity_result_update(id, hash, pResult, score, scoreMax);
}

__kernel void profanity_score_range(__global mp_number * const pInverse, __global result * const pResult, __constant const uchar * const data1, __constant const uchar * const data2, const uchar scoreMax) {
const size_t id = get_global_id(0);
__global const uchar * const hash = pInverse[id].d;
Expand Down
4 changes: 4 additions & 0 deletions profanity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ int main(int argc, char * * argv) {
bool bHelp = false;
bool bModeBenchmark = false;
bool bModeZeros = false;
bool bModeGas = false;
bool bModeLetters = false;
bool bModeNumbers = false;
std::string strModeLeading;
Expand Down Expand Up @@ -184,6 +185,7 @@ int main(int argc, char * * argv) {
argp.addSwitch('i', "inverse-size", inverseSize);
argp.addSwitch('I', "inverse-multiple", inverseMultiple);
argp.addSwitch('c', "contract", bMineContract);
argp.addSwitch('g', "gas", bModeGas);

if (!argp.parse()) {
std::cout << "error: bad arguments, try again :<" << std::endl;
Expand All @@ -200,6 +202,8 @@ int main(int argc, char * * argv) {
mode = Mode::benchmark();
} else if (bModeZeros) {
mode = Mode::zeros();
} else if (bModeGas) {
mode = Mode::gas();
} else if (bModeLetters) {
mode = Mode::letters();
} else if (bModeNumbers) {
Expand Down
Binary file added profanity.exe
Binary file not shown.
Binary file added profanity.x64
Binary file not shown.

0 comments on commit d017c59

Please sign in to comment.