Just cutting and pasting code to the forum can cause issues.
Code that is simply pasted with Ctrl + V:
#include <CL/cl.h>
#include <stdio.h>
#include <stdlib.h>
typedef unsigned int uint;
typedef unsigned long long ulong;
int cast_test(ulong a) {
float b = (float)a;
float c = __cast_ulong_float(a);
int d = *(int*)&b;
int e = *(int*)&c;
if (d == e) {
return 1;
} else {
fprintf(stderr," Input: %ld CPU: %lf(%x) CL: %ld(%x)\n", a, b, d, c, e);
return 0;
}
}
int main(void)
{
ulong correct, incorrect, total, x;
correct = incorrect = total = 0;
for (x = 0; x < (ulong)-1; ++x) {
correct += cast_test(x);
total++;
}
fprintf(stderr, "%ld correct out of %ld\n", correct, total);
return EXIT_SUCCESS;
}
Code that is pasted from 'Paste from Word':
#include <CL/cl.h>
#include <stdio.h>
#include <stdlib.h>
typedef unsigned int uint;
typedef unsigned long long ulong;
int cast_test(ulong a) {
float b = (float)a;
float c = __cast_ulong_float(a);
int d = *(int*)&b;
int e = *(int*)&c;
if (d == e) {
return 1;
} else {
fprintf(stderr," Input: %ld CPU: %lf(%x) CL: %ld(%x)\n", a, b, d, c, e);
return 0;
}
}
int main(void)
{
ulong correct, incorrect, total, x;
correct = incorrect = total = 0;
for (x = 0; x < (ulong)-1; ++x) {
correct += cast_test(x);
total++;
}
fprintf(stderr, "%ld correct out of %ld\n", correct, total);
return EXIT_SUCCESS;
}
Code that is pasted with the 'Past as Plain Text':
#include
#include
#include
typedef unsigned int uint;
typedef unsigned long long ulong;
int cast_test(ulong a) {
float b = (float)a;
float c = __cast_ulong_float(a);
int d = *(int*)&b;
int e = *(int*)&c;
if (d == e) {
return 1;
} else {
fprintf(stderr," Input: %ld CPU: %lf(%x) CL: %ld(%x)\n", a, b, d, c, e);
return 0;
}
}
int main(void)
{
ulong correct, incorrect, total, x;
correct = incorrect = total = 0;
for (x = 0; x < (ulong)-1; ++x) {
correct += cast_test(x);
total++;
}
fprintf(stderr, "%ld correct out of %ld\n", correct, total);
return EXIT_SUCCESS;
}
tags. For example: http://pastebin.com/m25bd93fb is the above code(link should last for a month), gives syntax highlighting for various languages. I'd recommend using this over pasting code directly into the forum.
Is there no possibility to add some working
tags that preserve indentations and do not add line feeds?
Not sure about the indentations, but if you make sure to select "Do not parse emoticons" it will prevent the forum software from putting in smileys in your code. 🙂
Micah,
Please make an arragments to fix the forum to be able to paste a code without an issues, or provide the tool (in text message window, for example) which will help to make it.
Keeping the code for a month is not a good idea at all! I am reading the topics 2 and more months old. Therefore, I will not understand most of the things in "kernel can'ts add 4 number..." thread in August
Raistmer, just noticed "do not parse emotions" check box, so it is not an issue.
Originally posted by: CaptainN
Raistmer, just noticed "do not parse emotions" check box, so it is not an issue.