Browse Source

Style police.

nfactor-troky
Con Kolivas 13 years ago
parent
commit
6442c1aba0
  1. 42
      ocl.c
  2. 6
      util.c

42
ocl.c

@ -75,14 +75,12 @@ int clDevicesNum() { @@ -75,14 +75,12 @@ int clDevicesNum() {
cl_platform_id platform = NULL;
status = clGetPlatformIDs(0, NULL, &numPlatforms);
/* If this fails, assume no GPUs. */
if (status != CL_SUCCESS)
{
if (status != CL_SUCCESS) {
applog(LOG_INFO, "clGetPlatformsIDs failed (no GPU?)");
return 0;
}
if (numPlatforms > 0)
{
if (numPlatforms > 0) {
cl_platform_id* platforms = (cl_platform_id *)malloc(numPlatforms*sizeof(cl_platform_id));
status = clGetPlatformIDs(numPlatforms, platforms, NULL);
if (status != CL_SUCCESS)
@ -92,8 +90,7 @@ int clDevicesNum() { @@ -92,8 +90,7 @@ int clDevicesNum() {
}
unsigned int i;
for(i=0; i < numPlatforms; ++i)
{
for (i = 0; i < numPlatforms; ++i) {
char pbuff[100];
status = clGetPlatformInfo( platforms[i], CL_PLATFORM_VENDOR, sizeof(pbuff), pbuff, NULL);
if (status != CL_SUCCESS)
@ -118,8 +115,7 @@ int clDevicesNum() { @@ -118,8 +115,7 @@ int clDevicesNum() {
cl_uint numDevices;
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
if (status != CL_SUCCESS)
{
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Device IDs (num)");
return -1;
}
@ -154,8 +150,7 @@ void patch_opcodes(char *w, unsigned remaining) @@ -154,8 +150,7 @@ void patch_opcodes(char *w, unsigned remaining)
int count_bfe_int = 0;
int count_bfe_uint = 0;
int count_byte_align = 0;
while (42)
{
while (42) {
int clamp = (*opcode >> (32 + 31)) & 0x1;
int dest_rel = (*opcode >> (32 + 28)) & 0x1;
int alu_inst = (*opcode >> (32 + 13)) & 0x1f;
@ -175,9 +170,8 @@ void patch_opcodes(char *w, unsigned remaining) @@ -175,9 +170,8 @@ void patch_opcodes(char *w, unsigned remaining)
patched++;
}
}
if (remaining <= 8) {
if (remaining <= 8)
break;
}
opcode++;
remaining -= 8;
}
@ -200,14 +194,12 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -200,14 +194,12 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
cl_uint numPlatforms;
cl_platform_id platform = NULL;
status = clGetPlatformIDs(0, NULL, &numPlatforms);
if (status != CL_SUCCESS)
{
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Platforms. (clGetPlatformsIDs)");
return NULL;
}
if (numPlatforms > 0)
{
if (numPlatforms > 0) {
cl_platform_id* platforms = (cl_platform_id *)malloc(numPlatforms*sizeof(cl_platform_id));
status = clGetPlatformIDs(numPlatforms, platforms, NULL);
if (status != CL_SUCCESS)
@ -216,8 +208,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -216,8 +208,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
return NULL;
}
for(i = 0; i < numPlatforms; ++i)
{
for(i = 0; i < numPlatforms; ++i) {
char pbuff[100];
status = clGetPlatformInfo( platforms[i], CL_PLATFORM_VENDOR, sizeof(pbuff), pbuff, NULL);
if (status != CL_SUCCESS)
@ -242,8 +233,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -242,8 +233,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
cl_uint numDevices;
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 0, NULL, &numDevices);
if (status != CL_SUCCESS)
{
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Device IDs (num)");
return NULL;
}
@ -255,8 +245,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -255,8 +245,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
/* Now, get the device list data */
status = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, numDevices, devices, NULL);
if (status != CL_SUCCESS)
{
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Device IDs (list)");
return NULL;
}
@ -267,8 +256,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -267,8 +256,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
for(i=0; i < numDevices; i++) {
char pbuff[100];
status = clGetDeviceInfo(devices[i], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
if (status != CL_SUCCESS)
{
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Device Info");
return NULL;
}
@ -279,8 +267,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -279,8 +267,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
if (gpu < numDevices) {
char pbuff[100];
status = clGetDeviceInfo(devices[gpu], CL_DEVICE_NAME, sizeof(pbuff), pbuff, NULL);
if (status != CL_SUCCESS)
{
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Getting Device Info");
return NULL;
}
@ -297,8 +284,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize) @@ -297,8 +284,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
cl_context_properties cps[3] = { CL_CONTEXT_PLATFORM, (cl_context_properties)platform, 0 };
clState->context = clCreateContextFromType(cps, CL_DEVICE_TYPE_GPU, NULL, NULL, &status);
if (status != CL_SUCCESS)
{
if (status != CL_SUCCESS) {
applog(LOG_ERR, "Error: Creating Context. (clCreateContextFromType)");
return NULL;
}

6
util.c

@ -336,9 +336,8 @@ json_t *json_rpc_call(CURL *curl, const char *url, @@ -336,9 +336,8 @@ json_t *json_rpc_call(CURL *curl, const char *url,
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_ENCODING, "");
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
if (!opt_delaynet) {
if (!opt_delaynet)
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
}
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, upload_data_cb);
@ -739,9 +738,8 @@ bool get_dondata(char **url, char **userpass) @@ -739,9 +738,8 @@ bool get_dondata(char **url, char **userpass)
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl, CURLOPT_ENCODING, "");
curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1);
if (!opt_delaynet) {
if (!opt_delaynet)
curl_easy_setopt(curl, CURLOPT_TCP_NODELAY, 1);
}
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, all_data_cb);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &all_data);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_err_str);

Loading…
Cancel
Save