-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Half: An IEEE 754 compliant float16 type #37630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8666adc
b0e4b70
1e5502a
a987011
250cc01
a3d03cf
999587b
6855b32
e9cf6a6
6cc1c6c
da5638f
8e3c977
6b85b56
3cbae92
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -499,5 +499,17 @@ public static unsafe float Int32BitsToSingle(int value) | |
|
|
||
| return *((float*)&value); | ||
| } | ||
|
|
||
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| internal static unsafe short HalfToInt16Bits(Half value) | ||
|
pgovind marked this conversation as resolved.
|
||
| { | ||
| return *((short*)&value); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wanted to call out it looks like the JIT does the right thing here: https://sharplab.io/#v2:EYLgxg9gTgpgtADwGwBYA0AXEBDAzgWwB8ABAJgEYBYAKGIAYACY8gOgCUBXAOwwEt8YLAMIR8AB14AbGFADKMgG68wMXAG4aNYgGYGuDFA5gMDABLZJAMxoBvGgwdNdsbABMIXSQE89AC2gmAPrAvBjqNAC+mrS63LjYljBMpAxCDHbUjk5+AQwAsuQAFOZWDL4AlOn2WY7EAOxlLMGh4ZmOUW0O1Q46OVAmeaTFFpZllRk1tQ0AVIWFuP790+UAZBUanQwdWd3ZC7l52sOlFVWbWfUMAKpc8YksAIK4ADwllmh9GAB8hbCj67sOhEgA=== |
||
| } | ||
|
|
||
| [MethodImpl(MethodImplOptions.AggressiveInlining)] | ||
| internal static unsafe Half Int16BitsToHalf(short value) | ||
|
pgovind marked this conversation as resolved.
|
||
| { | ||
| return *(Half*)&value; | ||
| } | ||
| } | ||
| } | ||
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.