pub fn classify_utf32(code: u32) -> Utf8TypeEnum {
    if code < 0x80u32 {
        Utf8TypeEnum::Type1(code as u8)
    }
    else if code < 0x800u32 {
        let v1:u8 = ((code >> 6) + TYPE2_PREFIX) as u8;
        let v2:u8 = ((code & SIX_ONES) + BYTE2_PREFIX) as u8;
        Utf8TypeEnum::Type2((v1,v2))
    }
    else if (code >= 0xD800u32) && (code < 0xE000u32) {
        // Illegal UTF16 surrogate range
        Utf8TypeEnum::Type0((REPLACE_PART1, REPLACE_PART2, REPLACE_PART3))
    }
    else if code < 0x10000u32 {
        if code == REPLACE_UTF32 {
            // Treat it the same whether it is a fresh invalid codepoint
            // or an old one from the past.
            Utf8TypeEnum::Type0((REPLACE_PART1, REPLACE_PART2, REPLACE_PART3))
        }
        else {
            let v1:u8 = ((code >> 12) + TYPE3_PREFIX) as u8;
            let v2:u8 = (((code & SIX_ONES_SHIFTED) >> 6) + BYTE2_PREFIX) as u8;
            let v3:u8 = ((code & SIX_ONES) + BYTE2_PREFIX) as u8;
            Utf8TypeEnum::Type3((v1,v2,v3))
        }
    }
    else if code < 0x110000u32 {
        let v1:u8 = ((code >> 18) + TYPE4_PREFIX) as u8;
        let v2:u8 = (((code >> 12) & SIX_ONES) + BYTE2_PREFIX) as u8;
        let v3:u8 = (((code & SIX_ONES_SHIFTED) >> 6) + BYTE2_PREFIX) as u8;
        let v4:u8 = ((code & SIX_ONES) + BYTE2_PREFIX) as u8;
        Utf8TypeEnum::Type4((v1,v2,v3,v4))
    }
    else {
        // beyond valid UTF32 range
        Utf8TypeEnum::Type0((REPLACE_PART1, REPLACE_PART2, REPLACE_PART3))
    }
}
/// Classify an UTF32 value into the type of UTF8 it belongs.
///
/// Returning Utf8TypeEnum::Type 1 to 4 indicates the sequence length.
///
/// Returning Utf8TypeEnum::Type0 indicates error.
/// # Arguments
/// * `code` - the codepoint to be classified

Classify an UTF32 value into the type of UTF8 it belongs.
Returning Utf8TypeEnum::Type 1 to 4 indicates the sequence length.

Returning Utf8TypeEnum::Type0 indicates error.
Classify an UTF32 value into the type of UTF8 it belongs . Returning Utf8TypeEnum :: Type 1 to 4 indicates the sequence length . Returning Utf8TypeEnum :: Type0 indicates error .
pub fn classify_utf32(code: u32) -> Utf8TypeEnum {
    if code < 0x80u32 {
        Utf8TypeEnum::Type1(code as u8)
    }
    else if code < 0x800u32 {
        let v1:u8 = ((code >> 6) + TYPE2_PREFIX) as u8;
        let v2:u8 = ((code & SIX_ONES) + BYTE2_PREFIX) as u8;
        Utf8TypeEnum::Type2((v1,v2))
    }
    else if (code >= 0xD800u32) && (code < 0xE000u32) {
        // Illegal UTF16 surrogate range
        Utf8TypeEnum::Type0((REPLACE_PART1, REPLACE_PART2, REPLACE_PART3))
    }
    else if code < 0x10000u32 {
        if code == REPLACE_UTF32 {
            // Treat it the same whether it is a fresh invalid codepoint
            // or an old one from the past.
            Utf8TypeEnum::Type0((REPLACE_PART1, REPLACE_PART2, REPLACE_PART3))
        }
        else {
            let v1:u8 = ((code >> 12) + TYPE3_PREFIX) as u8;
            let v2:u8 = (((code & SIX_ONES_SHIFTED) >> 6) + BYTE2_PREFIX) as u8;
            let v3:u8 = ((code & SIX_ONES) + BYTE2_PREFIX) as u8;
            Utf8TypeEnum::Type3((v1,v2,v3))
        }
    }
    else if code < 0x110000u32 {
        let v1:u8 = ((code >> 18) + TYPE4_PREFIX) as u8;
        let v2:u8 = (((code >> 12) & SIX_ONES) + BYTE2_PREFIX) as u8;
        let v3:u8 = (((code & SIX_ONES_SHIFTED) >> 6) + BYTE2_PREFIX) as u8;
        let v4:u8 = ((code & SIX_ONES) + BYTE2_PREFIX) as u8;
        Utf8TypeEnum::Type4((v1,v2,v3,v4))
    }
    else {
        // beyond valid UTF32 range
        Utf8TypeEnum::Type0((REPLACE_PART1, REPLACE_PART2, REPLACE_PART3))
    }
}
pub fn classify_utf32 ( code : u32 ) -> Utf8TypeEnum { if code < 0x80u32 { Utf8TypeEnum :: Type1 ( code as u8 ) } else if code < 0x800u32 { let v1 : u8 = ( ( code >> 6 ) + TYPE2_PREFIX ) as u8 ; let v2 : u8 = ( ( code & SIX_ONES ) + BYTE2_PREFIX ) as u8 ; Utf8TypeEnum :: Type2 ( ( v1 , v2 ) ) } else if ( code >= 0xD800u32 ) && ( code < 0xE000u32 ) { // Illegal UTF16 surrogate range
 Utf8TypeEnum :: Type0 ( ( REPLACE_PART1 , REPLACE_PART2 , REPLACE_PART3 ) ) } else if code < 0x10000u32 { if code == REPLACE_UTF32 { // Treat it the same whether it is a fresh invalid codepoint
 // or an old one from the past.
 Utf8TypeEnum :: Type0 ( ( REPLACE_PART1 , REPLACE_PART2 , REPLACE_PART3 ) ) } else { let v1 : u8 = ( ( code >> 12 ) + TYPE3_PREFIX ) as u8 ; let v2 : u8 = ( ( ( code & SIX_ONES_SHIFTED ) >> 6 ) + BYTE2_PREFIX ) as u8 ; let v3 : u8 = ( ( code & SIX_ONES ) + BYTE2_PREFIX ) as u8 ; Utf8TypeEnum :: Type3 ( ( v1 , v2 , v3 ) ) } } else if code < 0x110000u32 { let v1 : u8 = ( ( code >> 18 ) + TYPE4_PREFIX ) as u8 ; let v2 : u8 = ( ( ( code >> 12 ) & SIX_ONES ) + BYTE2_PREFIX ) as u8 ; let v3 : u8 = ( ( ( code & SIX_ONES_SHIFTED ) >> 6 ) + BYTE2_PREFIX ) as u8 ; let v4 : u8 = ( ( code & SIX_ONES ) + BYTE2_PREFIX ) as u8 ; Utf8TypeEnum :: Type4 ( ( v1 , v2 , v3 , v4 ) ) } else { // beyond valid UTF32 range
 Utf8TypeEnum :: Type0 ( ( REPLACE_PART1 , REPLACE_PART2 , REPLACE_PART3 ) ) } }
Classify an UTF32 value into the type of UTF8 it belongs.
Classify an UTF32 value into the type of UTF8 it belongs .
code
u32
code
u32
arguments

`code` - the codepoint to be classified
` code ` - the codepoint to be classified