     return cudaStatus;
 }
 
+void checkBitFunctions(int* theArray)
+{
+	for (int i = 0; i < cResults; i++)
+	{
+		theArray[GET_ARRAY_ELEMENT(i)] |= GET_BITMASK_INT(i);
+	}
+}
 
 int main()
 {
-	char *cIsPrime = (char *)malloc(cResultCharArraySize);
-	memset((void*)cIsPrime, 0x00, cResultCharArraySize);
+	int *cIsPrime = (int *)malloc(cResultArraySizeInBytes);
+	memset((void*)cIsPrime, 0x00, cResultArraySizeInBytes);
+	//checkBitFunctions(cIsPrime);
 
 	clock_t tStart = clock();
 	cudaError_t cudaStatus = calculatePrimeCuda(cIsPrime);

#endif */

// memory layout: index * 2 + 1
__global__ void calculatePrimeSingle(char *isPrime) 
{
	int x = threadIdx.x;
	int y = blockIdx.x;
	int i = blockDim.x * y + x;
	int numToCheck = i * 2 + 1;
	SET_BIT_CHAR_ARRAY(isPrime, i);
	for (int j = 3; j < (numToCheck / 2) && READ_BIT_CHAR_ARRAY(isPrime, i); j += 2) {
		if ((numToCheck % j) == 0) {
			CLEAR_BIT_CHAR_ARRAY(isPrime, i);
		}
	}
}

__global__ void clearAll(char *isPrime)
{
	int x = threadIdx.x;
	int y = blockIdx.x;
	int i = blockDim.x * y + x;
	CLEAR_BIT_CHAR_ARRAY(isPrime, i);
}

__global__ void setAll(char *isPrime)
{
	int x = threadIdx.x;
	int y = blockIdx.x;
	int i = blockDim.x * y + x;
	SET_BIT_CHAR_ARRAY(isPrime, i);
}


// Helper function for using CUDA to add vectors in parallel.
cudaError_t calculatePrimeCuda(char *isPrime)
{
    char *dev_isPrime = 0;
    cudaError_t cudaStatus;





    // Launch a kernel on the GPU with one thread for each element.
	calculatePrimeSingle <<<cNumBlocks, cMaxThreads >> >(dev_isPrime);

	//clearAll << <cNumBlocks, cMaxThreads >> >(dev_isPrime);
	//setAll << <cNumBlocks, cMaxThreads >> >(dev_isPrime);

    // Check for any errors launching the kernel
