Optimized Git Type Determination

- Optimized the type determination logic in ZCL_ABAPGIT_GIT_PACK=>GET_TYPE by removing the string conversion and processing the relevant bits directly
This commit is contained in:
Michael Käsemann 2018-08-01 10:56:37 +02:00 committed by Lars Hvam
parent aa90f278b7
commit 3331a73b86

View File

@ -785,23 +785,21 @@ CLASS ZCL_ABAPGIT_GIT_PACK IMPLEMENTATION.
METHOD get_type. METHOD get_type.
DATA: lv_char3 TYPE c LENGTH 3, CONSTANTS: c_mask TYPE x VALUE 112.
lv_bitbyte TYPE zif_abapgit_definitions=>ty_bitbyte. DATA: xtype TYPE x.
xtype = iv_x BIT-AND c_mask.
lv_bitbyte = zcl_abapgit_convert=>x_to_bitbyte( iv_x ). CASE xtype.
lv_char3 = lv_bitbyte+1. WHEN 16.
CASE lv_char3.
WHEN '001'.
rv_type = zif_abapgit_definitions=>gc_type-commit. rv_type = zif_abapgit_definitions=>gc_type-commit.
WHEN '010'. WHEN 32.
rv_type = zif_abapgit_definitions=>gc_type-tree. rv_type = zif_abapgit_definitions=>gc_type-tree.
WHEN '011'. WHEN 48.
rv_type = zif_abapgit_definitions=>gc_type-blob. rv_type = zif_abapgit_definitions=>gc_type-blob.
WHEN '100'. WHEN 64.
rv_type = zif_abapgit_definitions=>gc_type-tag. rv_type = zif_abapgit_definitions=>gc_type-tag.
WHEN '111'. WHEN 112.
rv_type = zif_abapgit_definitions=>gc_type-ref_d. rv_type = zif_abapgit_definitions=>gc_type-ref_d.
WHEN OTHERS. WHEN OTHERS.
zcx_abapgit_exception=>raise( 'Todo, unknown type' ). zcx_abapgit_exception=>raise( 'Todo, unknown type' ).