From c6020f6625fb98c0e96dd4f1946a7cd6b06877e9 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Mon, 8 Jun 2015 01:22:17 +0200 Subject: [PATCH] Don't read kernel file as string during runtime --- libethash-cl/ethash_cl_miner.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libethash-cl/ethash_cl_miner.cpp b/libethash-cl/ethash_cl_miner.cpp index 3d20ecc1b..f501d9642 100644 --- a/libethash-cl/ethash_cl_miner.cpp +++ b/libethash-cl/ethash_cl_miner.cpp @@ -233,9 +233,9 @@ bool ethash_cl_miner::init( m_workgroup_size = ((workgroup_size + 7) / 8) * 8; // patch source code - std::ifstream t("ethash_cl_miner_kernel.cl"); - std::string code((std::istreambuf_iterator(t)), - std::istreambuf_iterator()); + // note: ETHASH_CL_MINER_KERNEL is simply ethash_cl_miner_kernel.cl compiled + // into a byte array by bin2h.cmake. There is no need to load the file by hand in runtime + std::string code(ETHASH_CL_MINER_KERNEL, ETHASH_CL_MINER_KERNEL + ETHASH_CL_MINER_KERNEL_SIZE); add_definition(code, "GROUP_SIZE", m_workgroup_size); add_definition(code, "DAG_SIZE", (unsigned)(_dagSize / ETHASH_MIX_BYTES)); add_definition(code, "ACCESSES", ETHASH_ACCESSES);