Fixed small OpenMP bug.

Originally committed to SVN as r2089.
This commit is contained in:
Rodrigo Braz Monteiro 2008-03-21 03:02:39 +00:00
parent 21b3db9b2a
commit 398da989f9
3 changed files with 30 additions and 19 deletions

View file

@ -97,7 +97,7 @@
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
ConfigurationType="2"
CharacterSet="1"
WholeProgramOptimization="1"
>
@ -123,9 +123,11 @@
AdditionalIncludeDirectories="include/aegilib"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_WINDOWS"
RuntimeLibrary="2"
OpenMP="true"
OpenMP="false"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="prec.h"
AssemblerOutput="4"
AssemblerListingLocation="$(IntDir)\"
WarningLevel="4"
WarnAsError="true"
Detect64BitPortabilityProblems="true"
@ -144,11 +146,14 @@
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
Name="VCLinkerTool"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
@ -158,6 +163,12 @@
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>

View file

@ -236,24 +236,21 @@ size_t Athenasub::GetUTF8Len(const wchar_t *utf16)
// Convert UTF-16 to UTF-8
size_t Athenasub::UTF16toUTF8(const wchar_t *utf16,char *utf8)
{
wchar_t curChar = 1;
wchar_t curChar = utf16[0];
size_t value;
size_t written = 0;
for (size_t i=0;;i++) {
// Get next
curChar = utf16[i];
// 1 byte
if ((curChar & 0xFF80) == 0) {
*utf8++ = char(curChar);
utf8[written] = char(curChar);
if (curChar == 0) break;
written++;
}
// 2 bytes
else if ((curChar & 0xF800) == 0) {
*utf8++ = char(((curChar & 0x07C0) >> 6) | 0xC0);
*utf8++ = char((curChar & 0x003F) | 0x80);
utf8[written] = char(((curChar & 0x07C0) >> 6) | 0xC0);
utf8[written+1] = char((curChar & 0x003F) | 0x80);
written += 2;
}
@ -261,24 +258,27 @@ size_t Athenasub::UTF16toUTF8(const wchar_t *utf16,char *utf8)
else if ((curChar & 0xFC00) == 0xD800) {
// Read
value = (curChar - 0xD800) << 10;
value |= utf16[i+1] & 0x3FF;
i++;
value |= utf16[i] & 0x3FF;
// Write
*utf8++ = char(((value & 0x1C0000) >> 18) | 0xF0);
*utf8++ = char(((value & 0x03F000) >> 12) | 0x80);
*utf8++ = char(((value & 0x000FC0) >> 6) | 0x80);
*utf8++ = char((value & 0x00003F) | 0x80);
utf8[written] = char(((value & 0x1C0000) >> 18) | 0xF0);
utf8[written+1] = char(((value & 0x03F000) >> 12) | 0x80);
utf8[written+2] = char(((value & 0x000FC0) >> 6) | 0x80);
utf8[written+3] = char((value & 0x00003F) | 0x80);
written += 4;
}
// 3 bytes
else if (curChar & 0xF800) {
*utf8++ = char(((curChar & 0xF000) >> 12) | 0xE0);
*utf8++ = char(((curChar & 0x0FC0) >> 6) | 0x80);
*utf8++ = char((curChar & 0x003F) | 0x80);
utf8[written] = char(((curChar & 0xF000) >> 12) | 0xE0);
utf8[written+1] = char(((curChar & 0x0FC0) >> 6) | 0x80);
utf8[written+2] = char((curChar & 0x003F) | 0x80);
written += 3;
}
// Get next
curChar = utf16[i+1];
}
return written;
}

View file

@ -168,7 +168,7 @@ public:
long len = length;
#ifdef _OPENMP
#pragma omp parallel shared(overlap,len,line_length)
#pragma omp parallel shared(overlap,len)
#endif
{
short *raw_sample_data = new short[line_length*2];