mirror of
https://github.com/pound-emu/ballistic.git
synced 2026-01-31 01:15:21 +01:00
Makes Ballistic more inlime with BARR-C's style guide. Signed-off-by: Ronald Caesar <github43132@proton.me>
25 lines
611 B
C
25 lines
611 B
C
#include "bal_decoder.h"
|
|
#include "decoder_table_gen.h"
|
|
#include <stddef.h>
|
|
#include <stdio.h>
|
|
|
|
const bal_decoder_instruction_metadata_t *
|
|
bal_decode_arm64(const uint32_t instruction)
|
|
{
|
|
// Index is top 11 bits
|
|
const uint16_t index = instruction >> 21;
|
|
|
|
const decoder_bucket_t *bucket = &g_decoder_lookup_table[index];
|
|
for (size_t i = 0; i < bucket->count; ++i)
|
|
{
|
|
const bal_decoder_instruction_metadata_t *metadata = bucket->instructions[i];
|
|
|
|
if ((instruction & metadata->mask) == metadata->expected)
|
|
{
|
|
return metadata;
|
|
}
|
|
}
|
|
|
|
return NULL;
|
|
}
|