{"id":18637580,"url":"https://github.com/justin-marian/bitwise-interpretor","last_synced_at":"2025-11-04T14:30:28.845Z","repository":{"id":225403080,"uuid":"765905426","full_name":"justin-marian/bitwise-interpretor","owner":"justin-marian","description":"Simple encoder/decoder for arithmetic operations.","archived":false,"fork":false,"pushed_at":"2024-03-13T21:31:50.000Z","size":92,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-27T09:12:23.909Z","etag":null,"topics":["bit-manipulation","bitwise-operations","c","interpretor"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/justin-marian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-01T21:15:33.000Z","updated_at":"2024-03-02T08:56:50.000Z","dependencies_parsed_at":"2024-11-07T05:37:25.084Z","dependency_job_id":"3b7d2847-dbcc-4422-b823-107d7d644347","html_url":"https://github.com/justin-marian/bitwise-interpretor","commit_stats":null,"previous_names":["justin-marian/bitwise-interpretor"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justin-marian%2Fbitwise-interpretor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justin-marian%2Fbitwise-interpretor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justin-marian%2Fbitwise-interpretor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justin-marian%2Fbitwise-interpretor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justin-marian","download_url":"https://codeload.github.com/justin-marian/bitwise-interpretor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239433910,"owners_count":19637806,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bit-manipulation","bitwise-operations","c","interpretor"],"created_at":"2024-11-07T05:36:53.642Z","updated_at":"2025-11-04T14:30:28.794Z","avatar_url":"https://github.com/justin-marian.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bitwise Instruction Interpretor\n\nA simple interpretor that emulates a basic encoder/decoder for arithmetic operations.\nThe interpretor is capable of decoding and executing elementary arithmetic instructions such as **addition, subtraction, multiplication, and division**.\nAt its core, information is represented as bits which can be categorized into *instructions* and *data*.\nThe interpretor processes a string of bits as an instruction and then executes it.\n\n![INSTRUCTION_FORMAT](/pictures/instruction.png)\n\n## Instruction Decoding\n\nThe binary instruction is given in a specific format which includes the number of:\n\n- operations to execute: `N` [The number of operations, represented by **3** bits].\n- the operation codes: `Op` [The operation code for `+`,`-`,`*`,`/`, represented by **2** bits].\n- the operand sizes: `Dim` [The size of an operand, represented by **4** bits].\n\nThe output will display *N, the operators, and the operand size*.\n\n## Instruction Execution\n\nThis task extends `Instruction Decoding` by adding **operand reading and instruction execution**.\n\nOperands are read as `unsigned short` numbers and the number of operands.\n\nThe number is based on the following formula: `((N + 1) * Dim) / 16`, which is used to calculate the number of operands, where:\n\n- `16` is significant as it represents the size, in bits, of the `unsigned short` numbers being read as operands.\n- `Dim` and the number `N + 1` are multiplied together to calculate the total bit length of the operand data.\n\n**Note:** Dividing this total by 16 converts the bit length into the count of unsigned short numbers, aligning with the data type's storage capacity and ensuring accurate operand handling within the system's architecture. The instruction execution is carried out in the order of operations received.\n\n## Build the Project\n\nThe provided examples illustrate the usage of a command-line tool named bitwise for performing operations encoded in a specific format. The tool seems to support at least two commands: `decode` and `execute`.\nBut first build the project, follow the next commands:\n\n```bash\n$ cd build\n$ make build\ngcc ../bitwise.c -lm -o ../bitwise\n```\n\n**Example 1:**\n\nFormat `decode` command: `./bitwise decode \u003cCode\u003e`\n\n```bash\n$ ./bitwise decode 1646133248\nCommand: decode\nCode: 1646133248\nN : 4\nOps : + - + + \nDim : 16\n```\n\nFormat `execute` command: `./bitwise execute \u003cCode\u003e \u003coperand1\u003e \u003coperand2\u003e \u003coperand3\u003e ...`\n\n**Example 2:**\n\n```bash\n$ ./bitwise execute 1142423552 3 7 8 10\nCommand: execute\nCode: 1142423552\nEnter block:\noperands: 3 7 8 10 \nAnswer: 90\n```\n\n### Specifications\n\n- The total size of an instruction does not exceed `23 (3 + 8 * 2 + 4)` bits and thus fits into an `unsigned int`.\n- Numbers read from the keyboard are considered **unsigned**, but the ***result may be negative***; hence, an int type variable is used for the result.\n- Only the resulting number is displayed for compatibility with the automated checker.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustin-marian%2Fbitwise-interpretor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustin-marian%2Fbitwise-interpretor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustin-marian%2Fbitwise-interpretor/lists"}