再探c 类与结构体究竟谁快——考虑栈变量、栈分配、位整数、密封类

上传人:xins****2008 文档编号:103260949 上传时间:2019-10-06 格式:DOCX 页数:19 大小:30.95KB
返回 下载 相关 举报
再探c 类与结构体究竟谁快——考虑栈变量、栈分配、位整数、密封类_第1页
第1页 / 共19页
再探c 类与结构体究竟谁快——考虑栈变量、栈分配、位整数、密封类_第2页
第2页 / 共19页
再探c 类与结构体究竟谁快——考虑栈变量、栈分配、位整数、密封类_第3页
第3页 / 共19页
再探c 类与结构体究竟谁快——考虑栈变量、栈分配、位整数、密封类_第4页
第4页 / 共19页
再探c 类与结构体究竟谁快——考虑栈变量、栈分配、位整数、密封类_第5页
第5页 / 共19页
点击查看更多>>
资源描述

《再探c 类与结构体究竟谁快——考虑栈变量、栈分配、位整数、密封类》由会员分享,可在线阅读,更多相关《再探c 类与结构体究竟谁快——考虑栈变量、栈分配、位整数、密封类(19页珍藏版)》请在金锄头文库上搜索。

1、再探C#类与结构体究竟谁快考虑栈变量、栈分配、64位整数、密封类 上次我对C#类与结构体做了一次速度评测(http:/ System; using System.Collections.Generic; using System.Text; using System.Diagnostics; namespace TryPointerCall / / 指针操作接口 / public interface IPointerCall / / 指针操作 / / 源指针 / 修改后指针 unsafe byte* Ptr(byte* p); #region 非泛型 / / 非泛型 指针操作基类 / publ

2、ic abstract class PointerCall : IPointerCall public abstract unsafe byte* Ptr(byte* p); / / 非泛型 指针操作派生类: 指针+偏移 / public sealed class PointerCallAdd : PointerCall / / 偏移值 / public int Offset = 0; public override unsafe byte* Ptr(byte* p) return unchecked(p + Offset); / / 非泛型 指针操作密封类: 指针+偏移 / public s

3、ealed class SldPointerCallAdd : IPointerCall / / 偏移值 / public int Offset = 0; public unsafe byte* Ptr(byte* p) return unchecked(p + Offset); / / 非泛型 指针操作结构体: 指针+偏移 / public struct SPointerCallAdd : IPointerCall / / 偏移值 / public int Offset; public unsafe byte* Ptr(byte* p) return unchecked(p + Offset); #endregion #region 泛型 / ! C#不支持将整数类型作为泛型约束 ! /public abstract cla

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 大杂烩/其它

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号