Tech
[问与答] 大家是怎么判断 AI 写的代码是正确的?有验收标准吗?
如题
我最近也是在用 AI 写 nodejs ,但是遇到一些问题,先举例子。
1 、第一个 CRC32 的函数实现
function crc32(buf, init = 0xffffffff) {
// 预生成表(全局只初始化一次)
if (!crc32.table) {
const table = new Uint32Array(256)
for (let i = 0; i < 256; i++) {
let crc = i
for (let j = 0; j < 8; j++) {
crc = (crc >>> 1) ^ (crc & 1 ? 0xedb88320 : 0)
}
table[i] = crc >>> 0
}
crc32.table = table
}
let crc = init >>> 0
const tbl = crc32.table
for (const ...
Read the full discussion on V2EX
This article was aggregated from V2EX. Click to join the conversation.
View on V2EX