C# float与UInt16互转
//float拆分成两个UInt16
public static UInt16 FloatToTwoUInt16(float f)
{
byte[] bs = BitConvert.GetBytes(); UInt16 low = BitConverter.ToUInt16(bs, );
UInt16 high = BitConvert.ToUInt16(bs, ); return new UInt16[]{low, high};
} //UInt16转float
public static float TwoUInt16ToFloat(UInt16 high, UInt16 low)
{
Int32 sum = (high << )+(low & 0xFFFF);
byte[] bs = BitConverter.GetBytes(sum);
return BitConverter.ToSingle(bs, );
}
C# float与UInt16互转的更多相关文章
- 转:SDL2源代码分析
1:初始化(SDL_Init()) SDL简介 有关SDL的简介在<最简单的视音频播放示例7:SDL2播放RGB/YUV>以及<最简单的视音频播放示例9:SDL2播放PCM>中 ...
- Emgu学习之(二)——图像读取、显示、保存
visual Studio Community 2015 工程和源代码:http://pan.baidu.com/s/1o6u5Fdw 内容 在这篇文章中将提到以下内容: 从文件中读取图像 Image ...
- 使用Kinect2.0获取点云以在GLUT中显示
这篇文章用来记录Kinect2.0如何生成点云. 以下示例源自Kinect提供的example修改完成,其名称会在小标题下方注解. 首先,要获取点云需要获取图像的深度数据和颜色数据.最后再将深度数据与 ...
- SDL2源码分析2:窗体(SDL_Window)
===================================================== SDL源码分析系列文章列表: SDL2源码分析1:初始化(SDL_Init()) SDL2源 ...
- SDL2源代码分析2:窗口(SDL_Window)
===================================================== SDL源代码分析系列文章列表: SDL2源代码分析1:初始化(SDL_Init()) SDL ...
- 【python】入门指南1
基础的数据结构:int, float, string 注意:python入门系列的文章的示例均使用python3来完成. #!/bin/python a = 1 b = 1.0 c = 'string ...
- go之数据类型转换和类型断言
一.类型转换 1.1 简单类型转换 格式 valueOfTypeB = typeB(valueOfTypeA) int 转 float64 package main import "fmt& ...
- SDL2源代码分析
1:初始化(SDL_Init()) SDL简介 有关SDL的简介在<最简单的视音频播放示例7:SDL2播放RGB/YUV>以及<最简单的视音频播放示例9:SDL2播放PCM>中 ...
- LitJson报错记录
1.float转double报错 报错类型: Max allowed object depth reached while trying to export from type System.Coll ...
随机推荐
- vue中过滤器filters的使用
组件内写法 filters:{ filter:function(data,arg1,arg2){ return .... } } 全局写法 filters('filter',function(data ...
- YOLOv1
学习资料: https://blog.paperspace.com/tag/series-yolo/ https://blog.csdn.net/u014380165/article/details/ ...
- Samples topic
Rendering: http://www.cnblogs.com/miloyip/archive/2010/03/29/1698953.html http://www.scratchapixel.c ...
- 【leetcode】557. Reverse Words in a String III
Algorithm [leetcode]557. Reverse Words in a String III https://leetcode.com/problems/reverse-words-i ...
- mongodb 创建更新语法
创建文档 向MongoDB插入数据,使用insert, 如:db.refactor.insert({"refactor's blog":"http://www.cnblo ...
- struts2框架之国际化(参考第二天学习笔记)
国际化 1. 回忆之前的国际化 1). 资源包(key=字符串) > 命名:基本名称+local部分.properties,res_zh.properties,res_zh_CN.propert ...
- 阿里云服务器上通过Docker部署redmine
背景:在日常工作的过程中会遇到各种各样的问题,每个问题来了之后需要花时间解决.这里就面临两个问题. 1:问题责任不明确,有时候会遇到数据库或者物理服务器的问题,这时候就需要把相应问题指派给相应的人,传 ...
- Mybatis--01
mybatis 封装jdbc访问代码的一个框架 (hibernate) ORM对象关系映射 SpringMVC:用来封装servlet的框架 (struts) Spring:体系整合框架,其他框架的 ...
- bootstrap4简单使用和入门02-bootstrap的js组件简单使用
自带默认的css和js弹框控制 <!DOCTYPE html> <html lang="en"> <head> <meta charset ...
- ASP.NET MVC5高级编程 之 Ajax
jQuery不仅支持所有现代浏览器,包括IE.Firefox.Safari.Opera和Chrome等,还可以在编写代码和浏览器API冲突时隐藏不一致性(和错误). 1. jQuery jQuery擅 ...