<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.jackslab.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-cn">
		<id>http://wiki.jackslab.org/index.php?action=history&amp;feed=atom&amp;title=Ieeehalfprecision.c</id>
		<title>Ieeehalfprecision.c - 版本历史</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.jackslab.org/index.php?action=history&amp;feed=atom&amp;title=Ieeehalfprecision.c"/>
		<link rel="alternate" type="text/html" href="http://wiki.jackslab.org/index.php?title=Ieeehalfprecision.c&amp;action=history"/>
		<updated>2026-09-11T05:14:06Z</updated>
		<subtitle>本wiki的该页面的版本历史</subtitle>
		<generator>MediaWiki 1.19.2</generator>

	<entry>
		<id>http://wiki.jackslab.org/index.php?title=Ieeehalfprecision.c&amp;diff=12621&amp;oldid=prev</id>
		<title>2019年11月27日 (三) 10:04 Comcat</title>
		<link rel="alternate" type="text/html" href="http://wiki.jackslab.org/index.php?title=Ieeehalfprecision.c&amp;diff=12621&amp;oldid=prev"/>
				<updated>2019-11-27T10:04:12Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class='diff diff-contentalign-left'&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
			&lt;tr valign='top'&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;←上一版本&lt;/td&gt;
			&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;2019年11月27日 (三) 10:04的版本&lt;/td&gt;
			&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第65行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第65行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Macros ---------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Macros ---------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#define &lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;INT16_TYPE &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160;  short&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#define	INT16_TYPE	&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;		int16_t&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#define UINT16_TYPE &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;unsigned short&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#define	UINT16_TYPE	&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;		uint16_t&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#define &lt;del class=&quot;diffchange diffchange-inline&quot;&gt; &lt;/del&gt;INT32_TYPE &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160;  long&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#define	INT32_TYPE	&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;		int32_t&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#define UINT32_TYPE &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;unsigned long&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;#define	UINT32_TYPE	&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;		uint32_t&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Prototypes -----------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Prototypes -----------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;singles2halfp&lt;/del&gt;(void *target, void *source, int numel);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;float2halfp&lt;/ins&gt;(void *target, void *source, int numel);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;doubles2halfp&lt;/del&gt;(void *target, void *source, int numel);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;double2halfp&lt;/ins&gt;(void *target, void *source, int numel);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;halfp2singles&lt;/del&gt;(void *target, void *source, int numel);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;halfp2float&lt;/ins&gt;(void *target, void *source, int numel);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;halfp2doubles&lt;/del&gt;(void *target, void *source, int numel);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;halfp2double&lt;/ins&gt;(void *target, void *source, int numel);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Routine:&amp;#160; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;singles2halfp&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Routine:&amp;#160; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;float2halfp&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Input:&amp;#160; source = Address of 32-bit floating point data to convert&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Input:&amp;#160; source = Address of 32-bit floating point data to convert&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第92行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第92行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;singles2halfp&lt;/del&gt;(void *target, void *source, int numel)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;float2halfp&lt;/ins&gt;(void *target, void *source, int numel)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; UINT16_TYPE *hp = (UINT16_TYPE *) target; // Type pun output as an unsigned 16-bit int&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; UINT16_TYPE *hp = (UINT16_TYPE *) target; // Type pun output as an unsigned 16-bit int&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第172行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第172行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Routine:&amp;#160; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;doubles2halfp&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Routine:&amp;#160; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;double2halfp&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Input:&amp;#160; source = Address of 64-bit floating point data to convert&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Input:&amp;#160; source = Address of 64-bit floating point data to convert&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第185行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第185行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;doubles2halfp&lt;/del&gt;(void *target, void *source, int numel)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;double2halfp&lt;/ins&gt;(void *target, void *source, int numel)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; UINT16_TYPE *hp = (UINT16_TYPE *) target; // Type pun output as an unsigned 16-bit int&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; UINT16_TYPE *hp = (UINT16_TYPE *) target; // Type pun output as an unsigned 16-bit int&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第267行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第267行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Routine:&amp;#160; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;halfp2singles&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Routine:&amp;#160; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;halfp2float&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Input:&amp;#160; source = address of 16-bit data to convert&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Input:&amp;#160; source = address of 16-bit data to convert&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第280行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第280行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;halfp2singles&lt;/del&gt;(void *target, void *source, int numel)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;halfp2float&lt;/ins&gt;(void *target, void *source, int numel)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; UINT16_TYPE *hp = (UINT16_TYPE *) source; // Type pun input as an unsigned 16-bit int&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; UINT16_TYPE *hp = (UINT16_TYPE *) source; // Type pun input as an unsigned 16-bit int&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第352行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第352行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Routine:&amp;#160; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;halfp2singles&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Routine:&amp;#160; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;halfp2float&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Input:&amp;#160; source = address of 16-bit data to convert&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;// Input:&amp;#160; source = address of 16-bit data to convert&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第365行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第365行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;//-----------------------------------------------------------------------------&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;halfp2doubles&lt;/del&gt;(void *target, void *source, int numel)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;int &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;halfp2double&lt;/ins&gt;(void *target, void *source, int numel)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;{&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; UINT16_TYPE *hp = (UINT16_TYPE *) source; // Type pun input as an unsigned 16-bit int&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; UINT16_TYPE *hp = (UINT16_TYPE *) source; // Type pun input as an unsigned 16-bit int&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Comcat</name></author>	</entry>

	<entry>
		<id>http://wiki.jackslab.org/index.php?title=Ieeehalfprecision.c&amp;diff=12620&amp;oldid=prev</id>
		<title>Comcat：以“&lt;source lang=cpp&gt; /******************************************************************************  *  * Filename:    ieeehalfprecision.c  * Programmer:  James Tursa ...”为内容创建页面</title>
		<link rel="alternate" type="text/html" href="http://wiki.jackslab.org/index.php?title=Ieeehalfprecision.c&amp;diff=12620&amp;oldid=prev"/>
				<updated>2019-11-27T09:58:46Z</updated>
		
		<summary type="html">&lt;p&gt;以“&amp;lt;source lang=cpp&amp;gt; /******************************************************************************  *  * Filename:    ieeehalfprecision.c  * Programmer:  James Tursa ...”为内容创建页面&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;source lang=cpp&amp;gt;&lt;br /&gt;
/******************************************************************************&lt;br /&gt;
 *&lt;br /&gt;
 * Filename:    ieeehalfprecision.c&lt;br /&gt;
 * Programmer:  James Tursa&lt;br /&gt;
 * Version:     1.0&lt;br /&gt;
 * Date:        March 3, 2009&lt;br /&gt;
 * Copyright:   (c) 2009 by James Tursa, All Rights Reserved&lt;br /&gt;
 *&lt;br /&gt;
 *  This code uses the BSD License:&lt;br /&gt;
 *&lt;br /&gt;
 *  Redistribution and use in source and binary forms, with or without &lt;br /&gt;
 *  modification, are permitted provided that the following conditions are &lt;br /&gt;
 *  met:&lt;br /&gt;
 *&lt;br /&gt;
 *     * Redistributions of source code must retain the above copyright &lt;br /&gt;
 *       notice, this list of conditions and the following disclaimer.&lt;br /&gt;
 *     * Redistributions in binary form must reproduce the above copyright &lt;br /&gt;
 *       notice, this list of conditions and the following disclaimer in &lt;br /&gt;
 *       the documentation and/or other materials provided with the distribution&lt;br /&gt;
 *      &lt;br /&gt;
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &amp;quot;AS IS&amp;quot; &lt;br /&gt;
 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE &lt;br /&gt;
 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE &lt;br /&gt;
 *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE &lt;br /&gt;
 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR &lt;br /&gt;
 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF &lt;br /&gt;
 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS &lt;br /&gt;
 *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN &lt;br /&gt;
 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) &lt;br /&gt;
 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE &lt;br /&gt;
 *  POSSIBILITY OF SUCH DAMAGE.&lt;br /&gt;
 *&lt;br /&gt;
 * This file contains C code to convert between IEEE double, single, and half&lt;br /&gt;
 * precision floating point formats. The intended use is for standalone C code&lt;br /&gt;
 * that does not rely on MATLAB mex.h. The bit pattern for the half precision&lt;br /&gt;
 * floating point format is stored in a 16-bit unsigned int variable. The half&lt;br /&gt;
 * precision bit pattern definition is:&lt;br /&gt;
 *&lt;br /&gt;
 * 1 bit sign bit&lt;br /&gt;
 * 5 bits exponent, biased by 15&lt;br /&gt;
 * 10 bits mantissa, hidden leading bit, normalized to 1.0&lt;br /&gt;
 *&lt;br /&gt;
 * Special floating point bit patterns recognized and supported:&lt;br /&gt;
 *&lt;br /&gt;
 * All exponent bits zero:&lt;br /&gt;
 * - If all mantissa bits are zero, then number is zero (possibly signed)&lt;br /&gt;
 * - Otherwise, number is a denormalized bit pattern&lt;br /&gt;
 *&lt;br /&gt;
 * All exponent bits set to 1:&lt;br /&gt;
 * - If all mantissa bits are zero, then number is +Infinity or -Infinity&lt;br /&gt;
 * - Otherwise, number is NaN (Not a Number)&lt;br /&gt;
 *&lt;br /&gt;
 * For the denormalized cases, note that 2^(-24) is the smallest number that can&lt;br /&gt;
 * be represented in half precision exactly. 2^(-25) will convert to 2^(-24)&lt;br /&gt;
 * because of the rounding algorithm used, and 2^(-26) is too small and underflows&lt;br /&gt;
 * to zero.&lt;br /&gt;
 *&lt;br /&gt;
 ********************************************************************************/&lt;br /&gt;
&lt;br /&gt;
// Includes -------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;string.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Macros ---------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
#define  INT16_TYPE          short&lt;br /&gt;
#define UINT16_TYPE unsigned short&lt;br /&gt;
#define  INT32_TYPE          long&lt;br /&gt;
#define UINT32_TYPE unsigned long&lt;br /&gt;
&lt;br /&gt;
// Prototypes -----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
int singles2halfp(void *target, void *source, int numel);&lt;br /&gt;
int doubles2halfp(void *target, void *source, int numel);&lt;br /&gt;
int halfp2singles(void *target, void *source, int numel);&lt;br /&gt;
int halfp2doubles(void *target, void *source, int numel);&lt;br /&gt;
&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
//&lt;br /&gt;
// Routine:  singles2halfp&lt;br /&gt;
//&lt;br /&gt;
// Input:  source = Address of 32-bit floating point data to convert&lt;br /&gt;
//         numel  = Number of values at that address to convert&lt;br /&gt;
//&lt;br /&gt;
// Output: target = Address of 16-bit data to hold output (numel values)&lt;br /&gt;
//         return value = 0 if native floating point format is IEEE&lt;br /&gt;
//                      = 1 if native floating point format is not IEEE&lt;br /&gt;
//&lt;br /&gt;
// Programmer:  James Tursa&lt;br /&gt;
//&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
int singles2halfp(void *target, void *source, int numel)&lt;br /&gt;
{&lt;br /&gt;
    UINT16_TYPE *hp = (UINT16_TYPE *) target; // Type pun output as an unsigned 16-bit int&lt;br /&gt;
    UINT32_TYPE *xp = (UINT32_TYPE *) source; // Type pun input as an unsigned 32-bit int&lt;br /&gt;
    UINT16_TYPE    hs, he, hm;&lt;br /&gt;
    UINT32_TYPE x, xs, xe, xm;&lt;br /&gt;
    int hes;&lt;br /&gt;
    static int next;  // Little Endian adjustment&lt;br /&gt;
    static int checkieee = 1;  // Flag to check for IEEE754, Endian, and word size&lt;br /&gt;
    double one = 1.0; // Used for checking IEEE754 floating point format&lt;br /&gt;
    UINT32_TYPE *ip; // Used for checking IEEE754 floating point format&lt;br /&gt;
    &lt;br /&gt;
    if( checkieee ) { // 1st call, so check for IEEE754, Endian, and word size&lt;br /&gt;
        ip = (UINT32_TYPE *) &amp;amp;one;&lt;br /&gt;
        if( *ip ) { // If Big Endian, then no adjustment&lt;br /&gt;
            next = 0;&lt;br /&gt;
        } else { // If Little Endian, then adjustment will be necessary&lt;br /&gt;
            next = 1;&lt;br /&gt;
            ip++;&lt;br /&gt;
        }&lt;br /&gt;
        if( *ip != 0x3FF00000u ) { // Check for exact IEEE 754 bit pattern of 1.0&lt;br /&gt;
            return 1;  // Floating point bit pattern is not IEEE 754&lt;br /&gt;
        }&lt;br /&gt;
        if( sizeof(INT16_TYPE) != 2 || sizeof(INT32_TYPE) != 4 ) {&lt;br /&gt;
            return 1;  // short is not 16-bits, or long is not 32-bits.&lt;br /&gt;
        }&lt;br /&gt;
        checkieee = 0; // Everything checks out OK&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    if( source == NULL || target == NULL ) { // Nothing to convert (e.g., imag part of pure real)&lt;br /&gt;
        return 0;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    while( numel-- ) {&lt;br /&gt;
        x = *xp++;&lt;br /&gt;
        if( (x &amp;amp; 0x7FFFFFFFu) == 0 ) {  // Signed zero&lt;br /&gt;
            *hp++ = (UINT16_TYPE) (x &amp;gt;&amp;gt; 16);  // Return the signed zero&lt;br /&gt;
        } else { // Not zero&lt;br /&gt;
            xs = x &amp;amp; 0x80000000u;  // Pick off sign bit&lt;br /&gt;
            xe = x &amp;amp; 0x7F800000u;  // Pick off exponent bits&lt;br /&gt;
            xm = x &amp;amp; 0x007FFFFFu;  // Pick off mantissa bits&lt;br /&gt;
            if( xe == 0 ) {  // Denormal will underflow, return a signed zero&lt;br /&gt;
                *hp++ = (UINT16_TYPE) (xs &amp;gt;&amp;gt; 16);&lt;br /&gt;
            } else if( xe == 0x7F800000u ) {  // Inf or NaN (all the exponent bits are set)&lt;br /&gt;
                if( xm == 0 ) { // If mantissa is zero ...&lt;br /&gt;
                    *hp++ = (UINT16_TYPE) ((xs &amp;gt;&amp;gt; 16) | 0x7C00u); // Signed Inf&lt;br /&gt;
                } else {&lt;br /&gt;
                    *hp++ = (UINT16_TYPE) 0xFE00u; // NaN, only 1st mantissa bit set&lt;br /&gt;
                }&lt;br /&gt;
            } else { // Normalized number&lt;br /&gt;
                hs = (UINT16_TYPE) (xs &amp;gt;&amp;gt; 16); // Sign bit&lt;br /&gt;
                hes = ((int)(xe &amp;gt;&amp;gt; 23)) - 127 + 15; // Exponent unbias the single, then bias the halfp&lt;br /&gt;
                if( hes &amp;gt;= 0x1F ) {  // Overflow&lt;br /&gt;
                    *hp++ = (UINT16_TYPE) ((xs &amp;gt;&amp;gt; 16) | 0x7C00u); // Signed Inf&lt;br /&gt;
                } else if( hes &amp;lt;= 0 ) {  // Underflow&lt;br /&gt;
                    if( (14 - hes) &amp;gt; 24 ) {  // Mantissa shifted all the way off &amp;amp; no rounding possibility&lt;br /&gt;
                        hm = (UINT16_TYPE) 0u;  // Set mantissa to zero&lt;br /&gt;
                    } else {&lt;br /&gt;
                        xm |= 0x00800000u;  // Add the hidden leading bit&lt;br /&gt;
                        hm = (UINT16_TYPE) (xm &amp;gt;&amp;gt; (14 - hes)); // Mantissa&lt;br /&gt;
                        if( (xm &amp;gt;&amp;gt; (13 - hes)) &amp;amp; 0x00000001u ) // Check for rounding&lt;br /&gt;
                            hm += (UINT16_TYPE) 1u; // Round, might overflow into exp bit, but this is OK&lt;br /&gt;
                    }&lt;br /&gt;
                    *hp++ = (hs | hm); // Combine sign bit and mantissa bits, biased exponent is zero&lt;br /&gt;
                } else {&lt;br /&gt;
                    he = (UINT16_TYPE) (hes &amp;lt;&amp;lt; 10); // Exponent&lt;br /&gt;
                    hm = (UINT16_TYPE) (xm &amp;gt;&amp;gt; 13); // Mantissa&lt;br /&gt;
                    if( xm &amp;amp; 0x00001000u ) // Check for rounding&lt;br /&gt;
                        *hp++ = (hs | he | hm) + (UINT16_TYPE) 1u; // Round, might overflow to inf, this is OK&lt;br /&gt;
                    else&lt;br /&gt;
                        *hp++ = (hs | he | hm);  // No rounding&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
//&lt;br /&gt;
// Routine:  doubles2halfp&lt;br /&gt;
//&lt;br /&gt;
// Input:  source = Address of 64-bit floating point data to convert&lt;br /&gt;
//         numel  = Number of values at that address to convert&lt;br /&gt;
//&lt;br /&gt;
// Output: target = Address of 16-bit data to hold output (numel values)&lt;br /&gt;
//         return value = 0 if native floating point format is IEEE&lt;br /&gt;
//                      = 1 if native floating point format is not IEEE&lt;br /&gt;
//&lt;br /&gt;
// Programmer:  James Tursa&lt;br /&gt;
//&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
int doubles2halfp(void *target, void *source, int numel)&lt;br /&gt;
{&lt;br /&gt;
    UINT16_TYPE *hp = (UINT16_TYPE *) target; // Type pun output as an unsigned 16-bit int&lt;br /&gt;
    UINT32_TYPE *xp = (UINT32_TYPE *) source; // Type pun input as an unsigned 32-bit int&lt;br /&gt;
    UINT16_TYPE    hs, he, hm;&lt;br /&gt;
    UINT32_TYPE x, xs, xe, xm;&lt;br /&gt;
    int hes;&lt;br /&gt;
    static int next;  // Little Endian adjustment&lt;br /&gt;
    static int checkieee = 1;  // Flag to check for IEEE754, Endian, and word size&lt;br /&gt;
    double one = 1.0; // Used for checking IEEE754 floating point format&lt;br /&gt;
    UINT32_TYPE *ip; // Used for checking IEEE754 floating point format&lt;br /&gt;
    &lt;br /&gt;
    if( checkieee ) { // 1st call, so check for IEEE754, Endian, and word size&lt;br /&gt;
        ip = (UINT32_TYPE *) &amp;amp;one;&lt;br /&gt;
        if( *ip ) { // If Big Endian, then no adjustment&lt;br /&gt;
            next = 0;&lt;br /&gt;
        } else { // If Little Endian, then adjustment will be necessary&lt;br /&gt;
            next = 1;&lt;br /&gt;
            ip++;&lt;br /&gt;
        }&lt;br /&gt;
        if( *ip != 0x3FF00000u ) { // Check for exact IEEE 754 bit pattern of 1.0&lt;br /&gt;
            return 1;  // Floating point bit pattern is not IEEE 754&lt;br /&gt;
        }&lt;br /&gt;
        if( sizeof(INT16_TYPE) != 2 || sizeof(INT32_TYPE) != 4 ) {&lt;br /&gt;
            return 1;  // short is not 16-bits, or long is not 32-bits.&lt;br /&gt;
        }&lt;br /&gt;
        checkieee = 0; // Everything checks out OK&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    xp += next;  // Little Endian adjustment if necessary&lt;br /&gt;
    &lt;br /&gt;
    if( source == NULL || target == NULL ) { // Nothing to convert (e.g., imag part of pure real)&lt;br /&gt;
        return 0;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    while( numel-- ) {&lt;br /&gt;
        x = *xp++; xp++; // The extra xp++ is to skip over the remaining 32 bits of the mantissa&lt;br /&gt;
        if( (x &amp;amp; 0x7FFFFFFFu) == 0 ) {  // Signed zero&lt;br /&gt;
            *hp++ = (UINT16_TYPE) (x &amp;gt;&amp;gt; 16);  // Return the signed zero&lt;br /&gt;
        } else { // Not zero&lt;br /&gt;
            xs = x &amp;amp; 0x80000000u;  // Pick off sign bit&lt;br /&gt;
            xe = x &amp;amp; 0x7FF00000u;  // Pick off exponent bits&lt;br /&gt;
            xm = x &amp;amp; 0x000FFFFFu;  // Pick off mantissa bits&lt;br /&gt;
            if( xe == 0 ) {  // Denormal will underflow, return a signed zero&lt;br /&gt;
                *hp++ = (UINT16_TYPE) (xs &amp;gt;&amp;gt; 16);&lt;br /&gt;
            } else if( xe == 0x7FF00000u ) {  // Inf or NaN (all the exponent bits are set)&lt;br /&gt;
                if( xm == 0 ) { // If mantissa is zero ...&lt;br /&gt;
                    *hp++ = (UINT16_TYPE) ((xs &amp;gt;&amp;gt; 16) | 0x7C00u); // Signed Inf&lt;br /&gt;
                } else {&lt;br /&gt;
                    *hp++ = (UINT16_TYPE) 0xFE00u; // NaN, only 1st mantissa bit set&lt;br /&gt;
                }&lt;br /&gt;
            } else { // Normalized number&lt;br /&gt;
                hs = (UINT16_TYPE) (xs &amp;gt;&amp;gt; 16); // Sign bit&lt;br /&gt;
                hes = ((int)(xe &amp;gt;&amp;gt; 20)) - 1023 + 15; // Exponent unbias the double, then bias the halfp&lt;br /&gt;
                if( hes &amp;gt;= 0x1F ) {  // Overflow&lt;br /&gt;
                    *hp++ = (UINT16_TYPE) ((xs &amp;gt;&amp;gt; 16) | 0x7C00u); // Signed Inf&lt;br /&gt;
                } else if( hes &amp;lt;= 0 ) {  // Underflow&lt;br /&gt;
                    if( (10 - hes) &amp;gt; 21 ) {  // Mantissa shifted all the way off &amp;amp; no rounding possibility&lt;br /&gt;
                        hm = (UINT16_TYPE) 0u;  // Set mantissa to zero&lt;br /&gt;
                    } else {&lt;br /&gt;
                        xm |= 0x00100000u;  // Add the hidden leading bit&lt;br /&gt;
                        hm = (UINT16_TYPE) (xm &amp;gt;&amp;gt; (11 - hes)); // Mantissa&lt;br /&gt;
                        if( (xm &amp;gt;&amp;gt; (10 - hes)) &amp;amp; 0x00000001u ) // Check for rounding&lt;br /&gt;
                            hm += (UINT16_TYPE) 1u; // Round, might overflow into exp bit, but this is OK&lt;br /&gt;
                    }&lt;br /&gt;
                    *hp++ = (hs | hm); // Combine sign bit and mantissa bits, biased exponent is zero&lt;br /&gt;
                } else {&lt;br /&gt;
                    he = (UINT16_TYPE) (hes &amp;lt;&amp;lt; 10); // Exponent&lt;br /&gt;
                    hm = (UINT16_TYPE) (xm &amp;gt;&amp;gt; 10); // Mantissa&lt;br /&gt;
                    if( xm &amp;amp; 0x00000200u ) // Check for rounding&lt;br /&gt;
                        *hp++ = (hs | he | hm) + (UINT16_TYPE) 1u; // Round, might overflow to inf, this is OK&lt;br /&gt;
                    else&lt;br /&gt;
                        *hp++ = (hs | he | hm);  // No rounding&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
//&lt;br /&gt;
// Routine:  halfp2singles&lt;br /&gt;
//&lt;br /&gt;
// Input:  source = address of 16-bit data to convert&lt;br /&gt;
//         numel  = Number of values at that address to convert&lt;br /&gt;
//&lt;br /&gt;
// Output: target = Address of 32-bit floating point data to hold output (numel values)&lt;br /&gt;
//         return value = 0 if native floating point format is IEEE&lt;br /&gt;
//                      = 1 if native floating point format is not IEEE&lt;br /&gt;
//&lt;br /&gt;
// Programmer:  James Tursa&lt;br /&gt;
//&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
int halfp2singles(void *target, void *source, int numel)&lt;br /&gt;
{&lt;br /&gt;
    UINT16_TYPE *hp = (UINT16_TYPE *) source; // Type pun input as an unsigned 16-bit int&lt;br /&gt;
    UINT32_TYPE *xp = (UINT32_TYPE *) target; // Type pun output as an unsigned 32-bit int&lt;br /&gt;
    UINT16_TYPE h, hs, he, hm;&lt;br /&gt;
    UINT32_TYPE xs, xe, xm;&lt;br /&gt;
    INT32_TYPE xes;&lt;br /&gt;
    int e;&lt;br /&gt;
    static int next;  // Little Endian adjustment&lt;br /&gt;
    static int checkieee = 1;  // Flag to check for IEEE754, Endian, and word size&lt;br /&gt;
    double one = 1.0; // Used for checking IEEE754 floating point format&lt;br /&gt;
    UINT32_TYPE *ip; // Used for checking IEEE754 floating point format&lt;br /&gt;
    &lt;br /&gt;
    if( checkieee ) { // 1st call, so check for IEEE754, Endian, and word size&lt;br /&gt;
        ip = (UINT32_TYPE *) &amp;amp;one;&lt;br /&gt;
        if( *ip ) { // If Big Endian, then no adjustment&lt;br /&gt;
            next = 0;&lt;br /&gt;
        } else { // If Little Endian, then adjustment will be necessary&lt;br /&gt;
            next = 1;&lt;br /&gt;
            ip++;&lt;br /&gt;
        }&lt;br /&gt;
        if( *ip != 0x3FF00000u ) { // Check for exact IEEE 754 bit pattern of 1.0&lt;br /&gt;
            return 1;  // Floating point bit pattern is not IEEE 754&lt;br /&gt;
        }&lt;br /&gt;
        if( sizeof(INT16_TYPE) != 2 || sizeof(INT32_TYPE) != 4 ) {&lt;br /&gt;
            return 1;  // short is not 16-bits, or long is not 32-bits.&lt;br /&gt;
        }&lt;br /&gt;
        checkieee = 0; // Everything checks out OK&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    if( source == NULL || target == NULL ) // Nothing to convert (e.g., imag part of pure real)&lt;br /&gt;
        return 0;&lt;br /&gt;
    &lt;br /&gt;
    while( numel-- ) {&lt;br /&gt;
        h = *hp++;&lt;br /&gt;
        if( (h &amp;amp; 0x7FFFu) == 0 ) {  // Signed zero&lt;br /&gt;
            *xp++ = ((UINT32_TYPE) h) &amp;lt;&amp;lt; 16;  // Return the signed zero&lt;br /&gt;
        } else { // Not zero&lt;br /&gt;
            hs = h &amp;amp; 0x8000u;  // Pick off sign bit&lt;br /&gt;
            he = h &amp;amp; 0x7C00u;  // Pick off exponent bits&lt;br /&gt;
            hm = h &amp;amp; 0x03FFu;  // Pick off mantissa bits&lt;br /&gt;
            if( he == 0 ) {  // Denormal will convert to normalized&lt;br /&gt;
                e = -1; // The following loop figures out how much extra to adjust the exponent&lt;br /&gt;
                do {&lt;br /&gt;
                    e++;&lt;br /&gt;
                    hm &amp;lt;&amp;lt;= 1;&lt;br /&gt;
                } while( (hm &amp;amp; 0x0400u) == 0 ); // Shift until leading bit overflows into exponent bit&lt;br /&gt;
                xs = ((UINT32_TYPE) hs) &amp;lt;&amp;lt; 16; // Sign bit&lt;br /&gt;
                xes = ((INT32_TYPE) (he &amp;gt;&amp;gt; 10)) - 15 + 127 - e; // Exponent unbias the halfp, then bias the single&lt;br /&gt;
                xe = (UINT32_TYPE) (xes &amp;lt;&amp;lt; 23); // Exponent&lt;br /&gt;
                xm = ((UINT32_TYPE) (hm &amp;amp; 0x03FFu)) &amp;lt;&amp;lt; 13; // Mantissa&lt;br /&gt;
                *xp++ = (xs | xe | xm); // Combine sign bit, exponent bits, and mantissa bits&lt;br /&gt;
            } else if( he == 0x7C00u ) {  // Inf or NaN (all the exponent bits are set)&lt;br /&gt;
                if( hm == 0 ) { // If mantissa is zero ...&lt;br /&gt;
                    *xp++ = (((UINT32_TYPE) hs) &amp;lt;&amp;lt; 16) | ((UINT32_TYPE) 0x7F800000u); // Signed Inf&lt;br /&gt;
                } else {&lt;br /&gt;
                    *xp++ = (UINT32_TYPE) 0xFFC00000u; // NaN, only 1st mantissa bit set&lt;br /&gt;
                }&lt;br /&gt;
            } else { // Normalized number&lt;br /&gt;
                xs = ((UINT32_TYPE) hs) &amp;lt;&amp;lt; 16; // Sign bit&lt;br /&gt;
                xes = ((INT32_TYPE) (he &amp;gt;&amp;gt; 10)) - 15 + 127; // Exponent unbias the halfp, then bias the single&lt;br /&gt;
                xe = (UINT32_TYPE) (xes &amp;lt;&amp;lt; 23); // Exponent&lt;br /&gt;
                xm = ((UINT32_TYPE) hm) &amp;lt;&amp;lt; 13; // Mantissa&lt;br /&gt;
                *xp++ = (xs | xe | xm); // Combine sign bit, exponent bits, and mantissa bits&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
//&lt;br /&gt;
// Routine:  halfp2singles&lt;br /&gt;
//&lt;br /&gt;
// Input:  source = address of 16-bit data to convert&lt;br /&gt;
//         numel  = Number of values at that address to convert&lt;br /&gt;
//&lt;br /&gt;
// Output: target = Address of 32-bit floating point data to hold output (numel values)&lt;br /&gt;
//         return value = 0 if native floating point format is IEEE&lt;br /&gt;
//                      = 1 if native floating point format is not IEEE&lt;br /&gt;
//&lt;br /&gt;
// Programmer:  James Tursa&lt;br /&gt;
//&lt;br /&gt;
//-----------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
int halfp2doubles(void *target, void *source, int numel)&lt;br /&gt;
{&lt;br /&gt;
    UINT16_TYPE *hp = (UINT16_TYPE *) source; // Type pun input as an unsigned 16-bit int&lt;br /&gt;
    UINT32_TYPE *xp = (UINT32_TYPE *) target; // Type pun output as an unsigned 32-bit int&lt;br /&gt;
    UINT16_TYPE h, hs, he, hm;&lt;br /&gt;
    UINT32_TYPE xs, xe, xm;&lt;br /&gt;
    INT32_TYPE xes;&lt;br /&gt;
    int e;&lt;br /&gt;
    static int next;  // Little Endian adjustment&lt;br /&gt;
    static int checkieee = 1;  // Flag to check for IEEE754, Endian, and word size&lt;br /&gt;
    double one = 1.0; // Used for checking IEEE754 floating point format&lt;br /&gt;
    UINT32_TYPE *ip; // Used for checking IEEE754 floating point format&lt;br /&gt;
    &lt;br /&gt;
    if( checkieee ) { // 1st call, so check for IEEE754, Endian, and word size&lt;br /&gt;
        ip = (UINT32_TYPE *) &amp;amp;one;&lt;br /&gt;
        if( *ip ) { // If Big Endian, then no adjustment&lt;br /&gt;
            next = 0;&lt;br /&gt;
        } else { // If Little Endian, then adjustment will be necessary&lt;br /&gt;
            next = 1;&lt;br /&gt;
            ip++;&lt;br /&gt;
        }&lt;br /&gt;
        if( *ip != 0x3FF00000u ) { // Check for exact IEEE 754 bit pattern of 1.0&lt;br /&gt;
            return 1;  // Floating point bit pattern is not IEEE 754&lt;br /&gt;
        }&lt;br /&gt;
        if( sizeof(INT16_TYPE) != 2 || sizeof(INT32_TYPE) != 4 ) {&lt;br /&gt;
            return 1;  // short is not 16-bits, or long is not 32-bits.&lt;br /&gt;
        }&lt;br /&gt;
        checkieee = 0; // Everything checks out OK&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    xp += next;  // Little Endian adjustment if necessary&lt;br /&gt;
    &lt;br /&gt;
    if( source == NULL || target == NULL ) // Nothing to convert (e.g., imag part of pure real)&lt;br /&gt;
        return 0;&lt;br /&gt;
    &lt;br /&gt;
    while( numel-- ) {&lt;br /&gt;
        h = *hp++;&lt;br /&gt;
        if( (h &amp;amp; 0x7FFFu) == 0 ) {  // Signed zero&lt;br /&gt;
            *xp++ = ((UINT32_TYPE) h) &amp;lt;&amp;lt; 16;  // Return the signed zero&lt;br /&gt;
        } else { // Not zero&lt;br /&gt;
            hs = h &amp;amp; 0x8000u;  // Pick off sign bit&lt;br /&gt;
            he = h &amp;amp; 0x7C00u;  // Pick off exponent bits&lt;br /&gt;
            hm = h &amp;amp; 0x03FFu;  // Pick off mantissa bits&lt;br /&gt;
            if( he == 0 ) {  // Denormal will convert to normalized&lt;br /&gt;
                e = -1; // The following loop figures out how much extra to adjust the exponent&lt;br /&gt;
                do {&lt;br /&gt;
                    e++;&lt;br /&gt;
                    hm &amp;lt;&amp;lt;= 1;&lt;br /&gt;
                } while( (hm &amp;amp; 0x0400u) == 0 ); // Shift until leading bit overflows into exponent bit&lt;br /&gt;
                xs = ((UINT32_TYPE) hs) &amp;lt;&amp;lt; 16; // Sign bit&lt;br /&gt;
                xes = ((INT32_TYPE) (he &amp;gt;&amp;gt; 10)) - 15 + 1023 - e; // Exponent unbias the halfp, then bias the double&lt;br /&gt;
                xe = (UINT32_TYPE) (xes &amp;lt;&amp;lt; 20); // Exponent&lt;br /&gt;
                xm = ((UINT32_TYPE) (hm &amp;amp; 0x03FFu)) &amp;lt;&amp;lt; 10; // Mantissa&lt;br /&gt;
                *xp++ = (xs | xe | xm); // Combine sign bit, exponent bits, and mantissa bits&lt;br /&gt;
            } else if( he == 0x7C00u ) {  // Inf or NaN (all the exponent bits are set)&lt;br /&gt;
                if( hm == 0 ) { // If mantissa is zero ...&lt;br /&gt;
                    *xp++ = (((UINT32_TYPE) hs) &amp;lt;&amp;lt; 16) | ((UINT32_TYPE) 0x7FF00000u); // Signed Inf&lt;br /&gt;
                } else {&lt;br /&gt;
                    *xp++ = (UINT32_TYPE) 0xFFF80000u; // NaN, only the 1st mantissa bit set&lt;br /&gt;
                }&lt;br /&gt;
            } else {&lt;br /&gt;
                xs = ((UINT32_TYPE) hs) &amp;lt;&amp;lt; 16; // Sign bit&lt;br /&gt;
                xes = ((INT32_TYPE) (he &amp;gt;&amp;gt; 10)) - 15 + 1023; // Exponent unbias the halfp, then bias the double&lt;br /&gt;
                xe = (UINT32_TYPE) (xes &amp;lt;&amp;lt; 20); // Exponent&lt;br /&gt;
                xm = ((UINT32_TYPE) hm) &amp;lt;&amp;lt; 10; // Mantissa&lt;br /&gt;
                *xp++ = (xs | xe | xm); // Combine sign bit, exponent bits, and mantissa bits&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        xp++; // Skip over the remaining 32 bits of the mantissa&lt;br /&gt;
    }&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Comcat</name></author>	</entry>

	</feed>