Function report |
Source Code:lib\assoc_array.c |
Create Date:2022-07-28 06:54:26 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Handle insertion into the middle of a shortcut.
Proto:static bool assoc_array_insert_mid_shortcut(struct assoc_array_edit *edit, const struct assoc_array_ops *ops, struct assoc_array_walk_result *result)
Type:bool
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct assoc_array_edit * | edit | |
| const struct assoc_array_ops * | ops | |
| struct assoc_array_walk_result * | result |
| 807 | sc_segments = sc_segments |
| 808 | dissimilarity = dissimilarity |
| 810 | pr_devel("-->%s(ix=%d dis=%lx scix=%d)\n", __func__, level, dissimilarity, sc_level) |
| 819 | diff = __ffs - find first set bit in word*@word: The word to search* Undefined if no bit exists, so code should check against 0 first. |
| 820 | diff &= ~ASSOC_ARRAY_LEVEL_STEP_MASK |
| 821 | diff += sc_level & ~ASSOC_ARRAY_KEY_CHUNK_MASK |
| 824 | If Not back_pointer Then |
| 826 | Else if assoc_array_ptr_is_node(back_pointer) Then |
| 828 | ptr = slots[parent_slot] |
| 829 | Else |
| 830 | BUG() |
| 833 | excised_meta[0] = assoc_array_shortcut_to_ptr(shortcut) |
| 836 | new_n0 = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
| 837 | If Not new_n0 Then Return false |
| 839 | new_meta[0] = assoc_array_node_to_ptr(new_n0) |
| 840 | adjust_count_on = new_n0 |
| 846 | level += ASSOC_ARRAY_LEVEL_STEP |
| 850 | keylen >>= ASSOC_ARRAY_KEY_CHUNK_SHIFT |
| 852 | new_s0 = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
| 854 | If Not new_s0 Then Return false |
| 856 | new_meta[1] = assoc_array_shortcut_to_ptr(new_s0) |
| 857 | to = assoc_array_shortcut_to_ptr(new_s0) |
| 858 | back_pointer = back_pointer |
| 859 | parent_slot = parent_slot |
| 861 | skip_to_level = diff |
| 864 | parent_slot = 0 |
| 866 | No 3D Now!(index_key, index_key, keylen * sizeof(unsignedlong)) |
| 869 | blank = ULONG_MAX << (diff & ASSOC_ARRAY_KEY_CHUNK_MASK) |
| 872 | Else |
| 873 | pr_devel("no pre-shortcut\n") |
| 874 | to = assoc_array_node_to_ptr(new_n0) |
| 875 | back_pointer = back_pointer |
| 876 | parent_slot = parent_slot |
| 879 | side = assoc_array_ptr_to_node(next_node) |
| 885 | sc_slot = sc_segments >> (diff & ASSOC_ARRAY_KEY_CHUNK_MASK) |
| 886 | sc_slot &= ASSOC_ARRAY_FAN_MASK |
| 888 | pr_devel("new slot %lx >> %d -> %d\n", sc_segments, diff & ASSOC_ARRAY_KEY_CHUNK_MASK, sc_slot) |
| 896 | level = diff + ASSOC_ARRAY_LEVEL_STEP |
| 897 | If level < skip_to_level Then |
| 898 | pr_devel("post-shortcut %d...%d\n", level, skip_to_level) |
| 900 | keylen >>= ASSOC_ARRAY_KEY_CHUNK_SHIFT |
| 902 | new_s1 = kzalloc - allocate memory. The memory is set to zero.*@size: how many bytes of memory are required.*@flags: the type of memory to allocate (see kmalloc). |
| 904 | If Not new_s1 Then Return false |
| 906 | new_meta[2] = assoc_array_shortcut_to_ptr(new_s1) |
| 909 | parent_slot = sc_slot |
| 911 | skip_to_level = skip_to_level |
| 915 | No 3D Now!(index_key, index_key, keylen * sizeof(unsignedlong)) |
| 918 | ptr = back_pointer |
| 919 | to = assoc_array_shortcut_to_ptr(new_s1) |
| 920 | Else |
| 921 | pr_devel("no post-shortcut\n") |
| 929 | p = parent_slot |
| 931 | ptr = back_pointer |
| 932 | to = assoc_array_node_to_ptr(new_n0) |
| 942 | Return edit |
| Name | Describe |
|---|---|
| assoc_array_insert | assoc_array_insert - Script insertion of an object into an associative array*@array: The array to insert into |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |