当前位置: 首页 > news >正文

网站后缀有哪些建设网站不显示添加白名单

网站后缀有哪些,建设网站不显示添加白名单,网页设计代码大全下载,免费发帖的网站Electron使用WebAssembly实现CRC-8 MAXIM校验 将C/C语言代码#xff0c;经由WebAssembly编译为库函数#xff0c;可以在JS语言环境进行调用。这里介绍在Electron工具环境使用WebAssembly调用CRC-8 MAXIM格式校验的方式。 CRC-8 MAXIM校验函数WebAssembly源文件 C语言实现C…Electron使用WebAssembly实现CRC-8 MAXIM校验 将C/C语言代码经由WebAssembly编译为库函数可以在JS语言环境进行调用。这里介绍在Electron工具环境使用WebAssembly调用CRC-8 MAXIM格式校验的方式。 CRC-8 MAXIM校验函数WebAssembly源文件 C语言实现CRC-8 MAXIM格式校验的介绍见《C语言CRC-8 MAXIM格式校验函数》 选择上面介绍文章中的uint8_t PY_CRC_8_T_MAXIM_i(uint8_t *di, uint32_t len)校验函数建立一个新文件PY_CRC_8_T_MAXIM_i.cc #ifndef EM_PORT_API # if defined(__EMSCRIPTEN__) # include emscripten.h # if defined(__cplusplus) # define EM_PORT_API(rettype) extern C rettype EMSCRIPTEN_KEEPALIVE # else # define EM_PORT_API(rettype) rettype EMSCRIPTEN_KEEPALIVE # endif # else # if defined(__cplusplus) # define EM_PORT_API(rettype) extern C rettype # else # define EM_PORT_API(rettype) rettype # endif # endif #endif#include stdio.h #include stdint.h #include stdlib.hEM_PORT_API(void *) mymalloc(uint32_t size) {return malloc(size); }EM_PORT_API(void) myfree(void * ptr) {free(ptr); }EM_PORT_API(uint8_t) PY_CRC_8_T_MAXIM_i(uint8_t *di, uint32_t len) { uint8_t crc_poly 0x8C; //Bit sequence inversion of 0x31uint8_t data_t 0; //CRC registerfor(uint32_t i 0; i len; i){data_t ^ di[i]; //8-bit datafor (uint8_t j 0; j 8; j){if (data_t 0x01)data_t (data_t 1) ^ crc_poly;elsedata_t 1;}}return data_t; } 这个文件有三个函数导出前两个是获取和释放内存的函数后一个就是CRC-8 MAXIM校验函数的导出。 将这个文件进行WebAssembly编译就会得到两个库文件 将这几个文件拷贝到后面建立的Electron工程目录再进行调用。 Electron调用WebAssembly CRC-8 MAXIM函数演示源文件 下载Electron的Hello World例程并实现正常运行 然后将前面的3个WebAssembly相关文件放到例程根目录。再引入一个jQuery库。编写index.html文件如下 !DOCTYPE html htmlheadmeta charsetUTF-8titleWebAssembly Electron/titlescriptwindow.$ window.jQuery require(./js/jquery-3.3.1.min.js);/script/headbodyh1Hello World!/h1!-- All of the Node.js APIs are available in this renderer process. --We are using Node.js scriptdocument.write(process.versions.node)/script,Chromium scriptdocument.write(process.versions.chrome)/script,Electron scriptdocument.write(process.versions.electron)/script,p see console /pscript srcPY_CRC_8_T_MAXIM_i.js/scriptscript src./mainprocess.js/script /bodyscript// You can also require other files to run in this processrequire(./renderer.js)/script /html主要修改部分为引入了jQuery引入了PY_CRC_8_T_MAXIM_i.js以及引入了mainprocess.jsmainprocess.js是在例程根目录下新建的工程文件内容如下 // This file is required by the index.html file and will // be executed in the renderer process for that window. // All of the Node.js APIs are available in this process.//增加当前运行状态和当前运行进程/函数信息控制不产生误触发 window.namemainwindow; $(document).ready(function(){Module.onRuntimeInitialized function() {console.log(Module);}setTimeout(function(){var count 8;var ptr Module._mymalloc(count);for (var i 0; i count; i){Module.HEAP8[ptr i] 1i;}console.log(Module._PY_CRC_8_T_MAXIM_i(ptr, count));Module._myfree(ptr);},2000); //Delay is a must for Module initialized! }) mainprocess.js实现了WebAssembly库文件的导入和使用Module._mymalloc用于申请内存空间Module._myfree用于释放内存空间Module.HEAP8[ptr i] 1i;用于给申请到的内存空间从1开始赋值这里堆空间为8个字节因此赋值从1到8。Module._PY_CRC_8_T_MAXIM_i(ptr, count)则进行CRC-8 MAXIM校验函数的调用提供了内存指针和要校验的字节数量。 整个Electron工程环境的文件如下所示 Electron调用WebAssembly CRC-8 MAXIM函数演示效果 通过在控制台输入 npm start执行Electron工程打开console显示 131是打印出的CRC校验结果十六进制值为0x83, 通过在线工具比较验证 Electron使用WebAssembly实现CRC-8 MAXIM校验演示工程下载 Electron Demo工程下载包含已编译后的WebAssembly库文件 –End–
http://www.hkea.cn/news/14522693/

相关文章:

  • 高端网站建设方案范文湖北建设厅官方网站
  • 网站建设目的要求南阳公司注册
  • 怎么给一个网站做推广怎么创立一个自己的品牌
  • 小企业建网站关闭WordPress自动文章摘要
  • 河南亿元建设有限公司公司网站wordpress 获得分类
  • 一家专门做鞋子的网站寮步网站建设 优帮云
  • 网站建设的公司推荐居众装饰
  • 鹿泉城乡建设局网站易思网站系统
  • 越秀定制型网站建设asp网站做文件共享上传
  • 外贸商城网站系统海外销售工作难做吗
  • 好的网站怎么建设网站推广策划评估指标有哪些
  • 卡密网站怎么做营销网络推广方式有哪些
  • 网站搭建系统网站申请域名
  • 雅安公司做网站河南省住房城乡建设厅
  • 企业官网建站流程静态网站建设参考文献
  • 盘锦兴隆台住房和城乡建设网站wordpress页面版权修改不
  • 邹平做网站公司界首网站建设
  • 国外打开网站会不会乱码e脉通网站
  • 网站开发及技术东莞网站建设规范
  • 中医风格网站模板求个网站或者app
  • 网红营销网站广西建设网桂建云官网
  • 网站icp备案有效时间app推广视频
  • 一个大型网站建设得多少钱wordpress获取优酷视频缩略图
  • 在国外建网站方便吗设计网站客户体验
  • 怎么做网站然后卖出去公众号开发一般收费
  • 温州 做网站设计制作生态瓶教学设计
  • 做门户网站用什么模板初期做网站
  • access做调查表网站网站大全全部免费
  • 贵阳网站建设怎么样中国建设网官方网站济宁国泰
  • 做网站代理去拉人香蜜湖网站建设