{"id":4440,"date":"2017-02-12T17:34:49","date_gmt":"2017-02-12T09:34:49","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=4440"},"modified":"2017-02-12T17:35:51","modified_gmt":"2017-02-12T09:35:51","slug":"%e5%ad%a6%e4%b9%a0%e4%b8%ad%e7%9a%84%e4%b8%80%e4%ba%9b%e7%89%a2%e9%aa%9a%e3%80%82%e6%a0%88%e5%a0%86%e5%9c%b0%e5%9d%80%e6%a0%87%e5%87%86%e5%86%99%e6%b3%95%e3%80%82","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=4440","title":{"rendered":"\u5b66\u4e60\u4e2d\u7684\u4e00\u4e9b\u7262\u9a9a\u3002\u6808\/\u5806\u5730\u5740\u6807\u51c6\u5199\u6cd5\u3002"},"content":{"rendered":"<h3><span style=\"color: #ff0000\"><strong>\u6211\u4e00\u76f4\u90fd\u5728\u5bfb\u627e\u5404\u79cd\u4e1a\u52a1\u529f\u80fd\u7684\u6700\u7b80\u5355\u5199\u6cd5\uff0c\u7528\u51cf\u6cd5\u7684\u6a21\u5f0f\u6765\u5f00\u53d1\u8f6f\u4ef6\u3002\u4e0b\u9762\u662f\u6211\u7684\u5199\u6cd5\uff0c\u5982\u679c\u6709\u66f4\u7b80\u5355\u7684\u65b9\u6cd5\uff0c\u8bf7\u7559\u8a00\u544a\u77e5\u3002<\/strong><\/span><\/h3>\n<p>\u672c\u4eba\u518d\u5b66\u4e60\u7684\u8fc7\u7a0b\u4e2d\uff0c\u9047\u5230\u5f88\u591a\u96be\u9898\uff0cdelphi\u5f88\u591a\u5730\u65b9\u81ea\u8eab\u7684\u8bbe\u8ba1\u5c31\u5f88\u4e71\u3002<br \/>\n\u6bd4\u5982\u5bf9\u53c2\u6570\u4fee\u9970\u7b26\u7684\u7406\u89e3\uff0c\u7f51\u4e0a100\u7bc7\u6587\u7ae0 90\u7bc7\u90fd\u6709\u95ee\u9898 \u9519\u8bef\u7387\u975e\u5e38\u9ad8\u3002delphi \u7684\u6570\u636e\u7c7b\u578b\u6709\u5f88\u591a<br \/>\n\u540c\u4e00\u4e2a\u53c2\u6570\u4fee\u9970\u7b26 \u4fee\u9970 \u4e0d\u540c\u6570\u636e\u7c7b\u578b \u7684\u610f\u4e49\u90fd\u662f\u6709\u5dee\u5f02\u7684\u3002\u4f60\u6216\u8bb8\u8ba4\u4e3a\u4f60\u77e5\u9053 \u4f20\u503c\u4e0e\u4f20\u5740\uff1b<br \/>\n\u4f20\u5740 \u53c8\u53ef\u52062\u79cd\u60c5\u51b5\uff0c\u4f60\u53ef\u77e5\u9053\u3002<\/p>\n<hr \/>\n<p>\u518d\u6bd4\u5982 \u628a\u6307\u9488 \u8f6c\u6362\u6210 16\u8fdb\u5236\u3002\u7f51\u4e0a\u6709\u5f88\u591a\u4eba\u7684\u5199\u6cd5 \u90fd\u4e0d\u662f\u6807\u51c6\u7684\u3002\u53ef\u4ee5\u8ba8\u8bba\u4e0b\uff0c\u6211\u5f04\u4e86\u4e00\u4e2a\u6807\u51c6\u7684\u5199\u6cd5\uff0c\u517c\u5bb932\u4f4d\u4e0e64\u4f4d\u3002<\/p>\n<p>\u4eceIntToHex()\u8bf4\u8d77\uff0c\u8fd9\u4e2a\u65b9\u6cd5 \u5b98\u65b9\u8bbe\u8ba1\u65f6 \u662f\u5982\u4f55\u60f3\u7684 \u6211\u4e0d\u61c2\uff1b\u53cd\u6b63\u4e71\uff0c\u8fd9\u4e5f\u662f\u5bfc\u81f4\u5f88\u591a\u4eba \u628a\u6307\u9488\u8f6c\u6362\u621016 \u591a\u79cd\u5199\u6cd5\u7684\u4e3b\u8981\u539f\u56e0\u3002<\/p>\n<p>\u770b\u4e0b\u56fe \u5b98\u65b9\u63d0\u4f9b\u4e86 3\u4e2a\u51fd\u6570\uff1a<\/p>\n<p><a href=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2017\/02\/aaa.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-4442 size-full\" src=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2017\/02\/aaa.png\" width=\"771\" height=\"153\" srcset=\"https:\/\/blog.qdac.cc\/wp-content\/uploads\/2017\/02\/aaa.png 771w, https:\/\/blog.qdac.cc\/wp-content\/uploads\/2017\/02\/aaa-300x60.png 300w, https:\/\/blog.qdac.cc\/wp-content\/uploads\/2017\/02\/aaa-768x152.png 768w\" sizes=\"auto, (max-width: 771px) 100vw, 771px\" \/><\/a><\/p>\n<p>\u4f60\u8981\u77e5\u9053 32\u4f4d\u7a0b\u5e8f\uff0c\u6307\u9488\u662f\u65e0\u7b26\u53f732\u4f4d\u7684 \u5373Cardinal \u7c7b\u578b\uff1b64\u4f4d\u662f UInt64 \u7c7b\u578b\u3002<\/p>\n<p>\u5b98\u65b9\u4e0a\u9762\u4e09\u4e2a\u51fd\u6570\u4e2d\u63d0\u4f9b\u4e86 Uint64 \u5165\u53c2\uff0c\u5374\u6ca1\u6709\u63d0\u4f9bCardinal\u5165\u53c2\u7684\u91cd\u8f7d\u3002<\/p>\n<p>\u518d\u770b\u8fd9\u4e09\u4e2a\u51fd\u6570\u7684\u5b9e\u73b0\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">function IntToHex(Value: Integer; Digits: Integer): string;\r\nbegin\r\n  Result := _IntToHex(Cardinal(Value), Digits);\r\nend;\r\n\r\nfunction IntToHex(Value: Int64; Digits: Integer): string;\r\nbegin\r\n  Result := _IntToHex(Value, digits);\r\nend;\r\n\r\nfunction IntToHex(Value: UInt64; Digits: Integer): string;\r\nbegin\r\n  Result := _IntToHex(Value, digits);\r\nend;<\/pre>\n<p>\u4f60\u4f1a\u53d1\u73b0\u7b2c\u4e00\u4e2a\u51fd\u6570\uff0cInteger\u7684\u8fd9\u4e2a \u5185\u90e8\u53c8\u8f6c\u6210\u4e86 Cardinal \uff0c\u7136\u540e\u8c03\u7528\u4e86_IntToHex \uff0c\u800c\u8fd9\u4e2a\u51fd\u6570\u7684\u5165\u53c2\u662fUint64\uff0c\u6240\u4ee5\u53c8\u518d\u6b21\u628aCardinal \u8f6c\u6210\u4e86UInt64\uff1b\u6298\u817e\u4e0d\u6298\u817e\uff0c\u591a\u5199\u4e00\u4e2a\u51fd\u6570\u4f1a\u6b7b\u554a\uff1b\u4e0a\u9762\u4e09\u4e2a\u51fd\u6570 \u90fd\u8c03\u7528\u4e86 _IntToHex\uff0c\u6211\u4eec\u63a5\u4e0b\u6765\u770b\u8fd9\u4e2a\u51fd\u6570\uff1b<\/p>\n<p>function _IntToHex(Value: UInt64; Digits: Integer): string;<\/p>\n<p>\u4ed6\u7684\u5165\u53c2\u662f UInt64\uff0c\u6240\u4ee5\u8bf4 \u4e0a\u9762\u4e09\u4e2aIntToHex \u6700\u7ec8\u90fd\u53d8\u6210\u4e86UInt64\uff1b\u4e3a\u4ec0\u4e48\u6700\u7ec8 \u90fd\u7528\u4e86 UInt64\uff0c\u6211\u4eec\u8981\u770b\u8fd9\u4e2a\u51fd\u6570\u7684\u540d\u5b57: IntToHex \u610f\u601d\u662f\u628a\u6574\u578b\u8f6c\u621016\u8fdb\u5236\uff0c\u800c\u65e0\u7b26\u53f764\u4f4d \u6240\u80fd\u8868\u8fbe\u7684\u8303\u56f4\u6700\u5e7f\uff0c\u80fd\u517c\u5bb9\u4e00\u5207\u6574\u578b\uff1b\u5373Int8\u3001UInt8\u3001Int32\u3001UInt32(Cardinal)\u3001Int64\u90fd\u80fd\u8f6c\u6362\u6210 UInt64 \u800c\u4e0d\u6ea2\u51fa\u3002<\/p>\n<p>\u7f62\u4e86 \u7f62\u4e86 \u4e0d\u7ba1\u5b98\u65b9\u7684\u8bbe\u8ba1\u4e86\uff0c\u6211\u4eec\u53ea\u80fd\u518d\u5b98\u65b9\u7684\u57fa\u7840\u4e0a \u505a\u6211\u4eec\u60f3\u505a\u7684\u4e8b\uff1a<\/p>\n<p>\u62ff\u5230\u6808\u4e2d\u6307\u9488\u7684\u5730\u5740\u4e0e\u5806\u4e2d\u6570\u636e\u7684\u5730\u5740\u7684\u6807\u51c6\u5199\u6cd5\u662f\uff08\u8c01\u4e0d\u540c\u610f\u6b22\u8fce\u8ba8\u8bba\uff09\uff1a<\/p>\n<pre class=\"lang:delphi decode:true \">procedure TForm4.Button1Click(Sender: TObject);\r\nvar\r\n  s: string;\r\nbegin\r\n  s := 'QDAC';\r\n\r\n  \/\/\u6807\u51c6\u5199\u6cd5\r\n  Memo1.Lines.Add('\u6808\u4e2d\u6307\u9488\u5730\u5740\uff1a' + IntToHex(UInt64(Pointer(@s)), SizeOf(s)*2));\r\n  Memo1.Lines.Add('\u5806\u4e2d\u6570\u636e\u5730\u5740\uff1a' + IntToHex(UInt64(Pointer(s)), SizeOf(s)*2));\r\nend;<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u4e00\u76f4\u90fd\u5728\u5bfb\u627e\u5404\u79cd\u4e1a\u52a1\u529f\u80fd\u7684\u6700\u7b80\u5355\u5199\u6cd5\uff0c [&hellip;]<\/p>\n","protected":false},"author":117,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[21],"tags":[],"class_list":["post-4440","post","type-post","status-publish","format-standard","hentry","category-misc"],"views":5495,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/4440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/117"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4440"}],"version-history":[{"count":2,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/4440\/revisions"}],"predecessor-version":[{"id":4445,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/4440\/revisions\/4445"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}