Skip to content

Commit

Permalink
Merge pull request #51 from AntChainOpenLabs/fix_256bit_number
Browse files Browse the repository at this point in the history
fix 256 bit number
  • Loading branch information
zoowii authored Feb 26, 2024
2 parents 9fd52d5 + ac58ec5 commit cec668e
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ The Smart Intermediate Representation(short for IR) project is a new compiler fr
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Example](#example)
- [Build the Docker Image for the Command Line Tool](#build-the-docker-image-for-the-command-line-tool)
- [Build a Test IR Program](#build-a-test-ir-program)
- [Fetch the Docker Image and Build a Test IR Program](#fetch-the-docker-image-and-build-a-test-ir-program)
- [Documentation](#documentation)
- [Roadmap](#roadmap)
- [V0.1](#v01)
Expand Down Expand Up @@ -101,7 +100,7 @@ The IR is still under development. Contributions are always welcome. Please foll

## Community

![wechat group](./assets/wx.JPG)
![wechat group](./assets/wx.png)

![dingtalk group](./assets/dingtalk.png)

Expand Down
Binary file removed assets/wx.JPG
Binary file not shown.
Binary file added assets/wx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion smart_ir/src/runtime/stdlib/ir_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ typedef enum IRRuntimeType {
IR_RUNTIME_TYPE_I256 = 17,
} IRRuntimeType;

#define IRRuntimeIntegerTypeMaxEnum IR_RUNTIME_TYPE_I256
#define DefaultIRRuntimeIntegerTypeMaxEnum IR_RUNTIME_TYPE_I128

inline bool
__attribute__((artificial)) __attribute__((always_inline))
Expand Down
2 changes: 1 addition & 1 deletion smart_ir/src/runtime/stdlib/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ ir_builtin_json_decode_map(uint32_t runtime_class_offset, cJSON *obj)
char *key = elem->string;
if (TABLE_KEY_IS_INT(ret)) {
struct vector *int_str = vector_new(__strlen(key), 1, key);
if (ret->key_runtime_ty <= IR_RUNTIME_TYPE_U256) {
if (ret->key_runtime_ty <= IR_RUNTIME_TYPE_U128 || ret->key_runtime_ty == IR_RUNTIME_TYPE_U256) {
key = (char *)ir_builtin_str_to_u256(int_str);
}
else {
Expand Down
3 changes: 2 additions & 1 deletion smart_ir/src/runtime/stdlib/qhashtbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ struct qhashtbl_obj_s {
qhashtbl_obj_t *next; /*!< for chaining next collision object */
};

#define TABLE_KEY_IS_INT(tbl) ((tbl)->key_runtime_ty <= IRRuntimeIntegerTypeMaxEnum)
#define TABLE_KEY_IS_BIG_INT(tbl) ((tbl)->key_runtime_ty == IR_RUNTIME_TYPE_U256 || (tbl)->key_runtime_ty == IR_RUNTIME_TYPE_I256)
#define TABLE_KEY_IS_INT(tbl) (((tbl)->key_runtime_ty <= DefaultIRRuntimeIntegerTypeMaxEnum) || (TABLE_KEY_IS_BIG_INT(tbl)))

#ifdef __cplusplus
}
Expand Down

0 comments on commit cec668e

Please sign in to comment.