need some help to understand this code

I am new in c++ coding in this chapter I can not understand the meaning of " mask = 0x4<<16;"
Last edited on
The "brevity"* of your post could be interpreted as laziness or rudeness by some. You could at least explain how you came upon this code instead of having us have to search for it ourselves.

It's some OpenWrt (embedded operating systems programming on Linux) code for "GPIO chip intialization [sic] and handlers".
https://github.com/cgoder/openwrt_rtk/blob/master/rtk_openwrt_sdk/target/linux/rtkmips/files/arch/mips/rtl8197f/gpio.c

*To anyone else reading, what's a word like "brevity" or "terseness", but with only negative connotations?
Laconic, perhaps? But that seems more neutral.
Last edited on
thanks for your interesting , I can not switch gpio30 to be active_high , do you have any advice ?
Why did you remove the code from your OP?
0x4 << 16 means take the hex number 4 (which is 100 binary) and shift left by 16 bits giving 1000000000000000000 which is 0x40000 (hex). So mask is set to 0x40000.

Last edited on
Topic archived. No new replies allowed.