Skip to content
代码片段 群组 项目
提交 3482d63f 编辑于 作者: Timotej Ecimovic's avatar Timotej Ecimovic
浏览文件

Cleansing logic for integers. This needs to be all externalized.

上级 eb5a4861
No related branches found
No related tags found
无相关合并请求
......@@ -109,6 +109,12 @@ function asHex(value) {
}
}
function cleanseUints(uint) {
if (uint == 'uint24_t') return 'uint32_t'
if (uint == 'uint48_t') return 'uint8_t *'
return uint
}
/**
* Returns the default atomic C type for a given atomic from
* the database. These values are used unless there is an
......@@ -127,13 +133,12 @@ function defaultAtomicType(atomic) {
var ret = `${signed ? '' : 'u'}int${atomic.size * 8}_t`
// few exceptions
if (ret == 'uint24_t') ret = 'uint32_t'
ret = cleanseUints(ret)
return ret
} else if (atomic.name.startsWith('enum') || atomic.name.startsWith('data')) {
return `uint${atomic.name.slice(4)}_t`
return cleanseUints(`uint${atomic.name.slice(4)}_t`)
} else if (atomic.name.startsWith('bitmap')) {
return `uint${atomic.name.slice(6)}_t`
return cleanseUints(`uint${atomic.name.slice(6)}_t`)
} else {
switch (atomic.name) {
case 'utc_time':
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册