def _dxt_mask_set(swizzler_mask, log_c, log_x, log_y, log_z, c_mask, x_mask,
    y_mask, z_mask):
    """THIS FUNCTION WILL SWIZZLE AN ARRAY OF X,
    Y, Z, AND CHANNEL OFFSETS TOGETHER SO THAT
    ALL PIXELS PER DXT TEXEL ARE ADJACENT.

    MAKES IT SO THE FIRST BITS ARE THE CHANNEL AXIS,
    NEXT TWO BITS ARE THE X AXIS, AND THE NEXT 2 BITS
    ARE THE Y AXIS. THE REMAINDER OF THE X BITS ARE NEXT,
    FOLLOWED BY THE REMAINDER OF THE Y BITS, FOLLOWED BY
    THE REMAINDER OF THE Z BITS"""
    tmp_x = log_x
    tmp_y = log_y
    if tmp_x > 2:
        tmp_x = 2
    if tmp_y > 2:
        tmp_y = 2
    c_mask.extend([0] * log_c)
    x_mask.extend([log_c] * tmp_x)
    y_mask.extend([log_c + tmp_x] * tmp_y)
    z_mask.extend([log_c + tmp_x + tmp_y] * log_z)
    x_mask.extend([log_c + tmp_y + log_z] * (log_x - tmp_x))
    y_mask.extend([log_c + log_x + log_z] * (log_y - tmp_y))
