zoukankan      html  css  js  c++  java
  • 拆分Int64/long 到HighPart/LowPart类型

    今天研究C#调用API,需要把long类型拆分成LowPart和HighPart两部分,所以写了一个方法,来转换这两种类型。

     1using System;
     2
     3namespace Skyfei
     4{
     5    public struct LargeInteger
     6    {
     7        Int32 _LowPart;
     8        Int32 _HighPart;
     9        public Int32 LowPart
    10        {
    11            get
    12            {
    13                return _LowPart;
    14            }

    15            set 
    16            {
    17                _LowPart = value;
    18            }

    19        }

    20    
    21        public Int32 HighPart
    22        {
    23            get
    24            {
    25                return _HighPart;
    26            }

    27            set 
    28            {
    29                _HighPart = value;
    30            }

    31        }

    32    }

    33    /// <summary>
    34    /// LargeInteger 的摘要说明。
    35    /// </summary>

    36    public class LInteger
    37    {
    38        
    39        public LInteger()
    40        {
    41            //
    42            // TODO: 在此处添加构造函数逻辑
    43            //
    44        }

    45
    46        public static long GetLongValue(LargeInteger largeInteger)
    47        {            
    48            return (long)(((ulong)largeInteger.HighPart << 32+ (uint)largeInteger.LowPart);
    49        }

    50
    51        public static LargeInteger GetLargeIntegerValue(long longNumber)
    52        {        
    53            LargeInteger t = new LargeInteger();
    54            t.LowPart = (Int32) longNumber;
    55            t.HighPart = (Int32) (longNumber >> 32);
    56            return t;
    57        }

    58    }

    59}

    60
  • 相关阅读:
    centos7搭建ELK开源实时日志分析系统
    基于ELK的简单数据分析
    用ELK打造可视化集中式日志
    elk单台环境搭建
    用logstash,elasticSearch,kibana实现数据收集和统计分析工作
    用Kibana和logstash快速搭建实时日志查询、收集与分析系统
    elasticsearch按照配置时遇到的一些坑 [Failed to load settings from [elasticsearch.yml]]
    分布式搜索elasticsearch几个概念解析
    分布式搜索elasticsearch配置文件详解
    CENTOS安装ElasticSearch
  • 原文地址:https://www.cnblogs.com/skyfei/p/186756.html
Copyright © 2011-2022 走看看