forked from ViewFaceCore/ViewFaceCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
1,097 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
src/Extensions/ViewFaceCore.Extension.Shared/ViewFaceAsyncExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
src/Extensions/ViewFaceCore.Extension.Shared/ViewFaceCoreExtension.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
|
||
namespace ViewFaceCore.Configs | ||
{ | ||
public static class GlobalConfig | ||
{ | ||
#region Log | ||
|
||
public static Action<string> LogEvent { get; private set; } | ||
|
||
/// <summary> | ||
/// 绑定log event | ||
/// </summary> | ||
/// <param name="action"></param> | ||
public static void SetLog(Action<string> action) | ||
{ | ||
if (action == null) return; | ||
if (LogEvent != null) return; | ||
LogEvent = action; | ||
} | ||
|
||
/// <summary> | ||
/// 对外写日志 | ||
/// </summary> | ||
/// <param name="log"></param> | ||
internal static void WriteLog(string log) | ||
{ | ||
if (LogEvent != null) | ||
{ | ||
LogEvent(log); | ||
} | ||
} | ||
|
||
#endregion | ||
|
||
#region Instruction | ||
|
||
private static bool _isSetX86Instruction = false; | ||
|
||
private static readonly object _setX86InstructionLocker = new object(); | ||
|
||
/// <summary> | ||
/// 在x86环境下支持的指令集 | ||
/// </summary> | ||
public static X86Instruction X86Instruction { get; private set; } = X86Instruction.AVX2 | X86Instruction.SSE2 | X86Instruction.FMA; | ||
|
||
/// <summary> | ||
/// 设置支持的指令集 | ||
/// </summary> | ||
/// <param name="instruction"></param> | ||
public static void SetX86Instruction(X86Instruction instruction) | ||
{ | ||
if (_isSetX86Instruction) | ||
return; | ||
if (RuntimeInformation.ProcessArchitecture != Architecture.X86 && RuntimeInformation.ProcessArchitecture != Architecture.X64) | ||
return; | ||
lock (_setX86InstructionLocker) | ||
{ | ||
if (_isSetX86Instruction) | ||
return; | ||
_isSetX86Instruction = true; | ||
X86Instruction = instruction; | ||
} | ||
} | ||
|
||
#endregion | ||
} | ||
|
||
public enum X86Instruction | ||
{ | ||
AVX2 = 1 << 0, | ||
|
||
SSE2 = 1 << 1, | ||
|
||
FMA = 1 << 2, | ||
} | ||
} |
Oops, something went wrong.