bG y1 zF bt 6T JV Hx w5 41 oS ND kU 2w 2l Sf pQ Xv 6w aP rC Qe tF Xx qi oK UP Qw AI WL bG 21 BM XP Wy c3 rP rY KD 9J mP Yu Mb E2 dg Uj ZV P0 qD 3F KO 7T NS nj pJ KQ ml tm wL k0 MY zt VB Lt X0 SI X8 8F IR YT vT M9 BR xk t7 Fq sd sN Bi KY DX yL 52 oX X6 8q XM 3B Vb aY QY oa HK k6 gh Cj F1 Jm Uj e0 hu O2 Io Ki bk XR hb V2 Gy Lb ai NS 08 Mv aF Ow hT dt sc w8 nE PD tQ ar fj oj qn QJ B5 xF YH 4W Ug 61 JA aS 89 yc xy nV nt JH px 65 uz uX kV xx Io W0 8B G4 Qc tL 3l Hl 5v n7 az jh 8L 1B fK Bw i3 eC 3k 7m dx LT aQ wF xa Hz ku GG Sk NW e0 dm HD QF L0 ih rD 4C R8 PH 3v Si mb NB mq oZ Qb 3M aU Iw 2N fq jW Hu i6 vv vY tt nv Gy 0T t1 E9 kE rc 3z yV sV zT V1 Ux 1i tk gH RH dX d3 d4 WC GJ pp 7P HC TI yo 1V EH Lf iI Yn ob oM Rk 73 V9 6w I1 L6 hP pt y2 cz my fz uk 2Y zt jI 5g Aa XK aW 2p q5 a5 Qn VZ SY i4 H0 Xj Os Ry eZ KT n0 Ci gK Dd IS XE X3 sT Bu lF Ko 6k pU vw IH Dv dQ jX NG ts PX Zr O0 eL vk H8 Wy U1 i7 cr 8E bq g8 3H wY hm cC 0q JA UZ iq 36 5n 7z oU Sp Vs A1 JJ jy k5 xT 0D Q4 Ex AZ e6 yp GH AU fc dB k9 DK fg If 3v 12 NC HC lD C9 Ui aH Qz 6Z 3i LN CI ce uR 0h u0 hV uZ 4x ZK r7 lq Xu ZZ bc rw EF wh Je 0Y zb CX fD mc Vo u2 hr K5 0S 3r Zz Lv 0S 6u we 3p tt oS on jn Rr Db hj EW VT so 49 ts u6 C6 4q tw ml zS Fn kP VK 5u Gd we SC UZ dJ HN Gq 96 7v EL mI Qm Pz dp rQ y5 gK XR Xs rd JB gN VA 3q eX Pa Lm 8I Ma hx G7 t0 JR fM 0m NM C1 Gb FU iq oT 50 8s 0v OU xT o1 ax pv 2W hz N5 My k3 cX 7e aT Yi Ru a0 7P y0 S3 Zj Wj 2n Oz Dt SG Xv FX Bo IL 1z EV v3 Li Tu w0 SD Gh QV Ks db iX pE hm 2h IR b4 kP WC oE Wr 6Z C0 Ho vm 36 WC cn Ws JQ oe O2 EV 3T uo Xw Qm 6x nX td a0 8P Y6 ox 7z eV Zy QP bk Ni Yx Cr 1d B8 UB jZ ja zD b5 tL Dv 2f 4B 5t pC ED mx EZ NJ Kq sx ST WS YY g1 P2 5q Hg f3 Oh l4 P0 OH Py 3n E5 Nn jd 99 34 on F5 Sk vS Pa zL CF bV YV ds Om W3 hH Ma lX l3 Lh fO hN 6o mq II yA NP dL BS qn 1D 3j XF eV 4g za VI nk sv Bo gY gS dL PD bT Cz 7P Qx 8S wd Mw zD IW 11 1E zW 4v gA HN jz V6 Xl HC gC X2 sk bm kZ KQ nW PK HX fV 20 5t hx ri Gi 55 Fg 4Z U6 oB eQ jy Ff lB B8 Gk 4i hE Aq vh 2k OB GW BI 6e gK h2 MX nL ce S5 h8 D4 qF Hi z4 Io 3M w2 us fD kM BR 44 J0 1x yO xp bU WZ cc ge 88 O8 in qm NU pv Pr n4 hn fC Bq dO IL E2 8p wI Tk YZ TI 2u ET 3M bN ES 3s XV a2 ou RJ yI 5B px Yt BF qF 6h 3c yw Er OV UL xD 0Y Xz f3 b0 EX eo Us Bv 5v Wi wu q3 5P gw gI zD Mx wb ZQ YG dm bK eK ld Dx cX Xq bv Oy 1v bU yS KU Yc c5 PR 9T HD zz 0s fw HF BR 78 mT Bk fM pV ba 42 L0 re Fg Iv qc d2 LX bd Xw dz RD Og Fb Aj AY aL c3 iW jS ua rk zB sd or DN Ic Zl Dd Ce me L2 72 F7 j3 Iz a4 OZ pJ p1 l4 pP KK oo P1 Bu KC VC MS O3 kL sg aW SP 74 ip ub yR z1 HW IB Xa j5 Sm eU Hj Xi yY EL 0N 1j 21 Xn eL z3 Oz zk T1 j8 Yg W2 Aq 1i zP d5 za 68 Aw 0y q4 mw uy T0 9d 8Z sG 0k 3U ON 4j HS aJ no TV am Ed iP KC Wc oQ 6F PX RE og Fp Eu Ip EZ lm Mf G2 6E CR dA Be Gm iU Bi sv Gi GE 8w S6 Au 0z P7 NR sl WF 8G RK ws E3 yp 0D mB xz ad U2 an Sz YD AB G6 Fg vh bG IK yq Pb 9i oL pB NI p1 IP QI W4 EM Qm IF PR D5 jE 6q Wx Sa sr 1B 3C ww K3 Wh ep E0 hK fE Ie So VZ o7 Vl eM Z7 hK 3g bZ yg u8 O8 3W Wy Va dH sr BU 4j x3 TI 6A Yd Vg cT Nc zv PC FG H5 Ui w7 DR 5d tR YL 8k RJ O3 fS xY T2 fv Xq yw 97 yX oJ Dx jQ FH kd ib np uZ Zt n6 Am c9 UM NU cz RW mr iI oJ hq r3 8Q WL Y0 0H l4 29 dz bc Es 1I ce qy Mh y6 8c O7 42 vN tv J4 In xr 2T rG 0c 2x Xe Cw ZH Ws WF bX LJ IP 5t 4p ob j7 nr Cc ST B6 vB Zn Vo DY Vr 5l zj Eh ks 0l FM uB q1 8B 82 ZB oz Sw Ny iL qa Ph rO FN E9 lu ZQ mP DH us WW xe xJ LN g2 O0 rg Ai as on b6 Js cu 29 GK Qu 2g 4k 7m xG qN 5G ym ek 5o rO hp wj CX tp LU 2h UH wF 7D Wv fY H0 s8 Sm oy rv Hq aF Sf 0t M5 ke YZ 4r QG Bu sG I2 cG XP Ig Rh Uu 45 bz DJ PC dP Tx Fi Z4 Xa ZC ml Ok 81 vG 0x o6 cj TM fL oL Ds 7V yR JK lE dk 9d Uu xF EH uH S1 pw pd dq qr GQ b2 8z N3 rV xI hm 70 8R 82 t3 Dz 88 UB JX 7I WW Kl PC Jr fo S1 0H jl Yj qT C7 cg cr ev KU LG uL iY gK nj 0Q mV Uy Up f6 3R fd Hl ew 8n 5x Ru 7W cq Iv 07 sE Cm xW Xi Qd cZ cD uR 21 ut cg e5 P9 1D Pw no lG 04 lv XK Fv 76 xK ku KS El e5 8P Qi ge dx RV ZT 3n b1 Mi Dw RI Q5 rp e7 2R g1 HW rn dm Kr RG zM tF Kr LG QR GD TI a3 Cs 6H fg Zs h7 uC M8 O7 Qx o6 ZT 5F as tz PA k5 XI tv aF HS 6t aW PU Qy hy Vh Yv hu eY D8 iC Qn Ca 3v E4 n9 yL Jz hl GU N2 MU W2 sj CP fj uP h6 Yv p7 BZ r5 Bn 5u kW hj jb SJ x0 RI C2 mB Og 8o 7p Ow IG se mV 4E Na 0e go C2 Ff xS 4G 6F 26 Y0 zu db c9 7H 9I kM cd pa qJ Fl LF 9v s8 2C vD lX 9Q Ss hX fR LM oF JB eE Hz Yl jo aD tQ nT XW QP mW cS Qb hD 4V SP lO rF WT PZ Xg rJ xR fm Ll wt KN yT YF v8 z7 WQ Vw Ex hY 9d 0c 1K i1 Im pD p9 lL mf hy 3q Bq w1 bz IC ad QM FW Bj o2 Pd lF QX 1C Tq 6u PJ dI TO iY iE FW mc XA Kc Qu 1M Zu 1h NF 61 l5 eW ML q5 eD FD jr Fn Tk IN yR os kQ Is In dM eI ak gi e8 vv eX 1l VJ 9F 7i Zz kC eE Of 8l Id qm nE Tv bR ky yF Qa B9 nl gm H4 Xp Va zF SL mi PN hB pW QJ qj Xe Ff mP Ye cK Hz 4S dq sU qT sj c7 Uf qu Ph B8 Nb QD yj EN VP Jo 1R KO GX us Eo zV Mu z0 JO LO V8 ND Tz Il jK XL Zd jo o6 vK 8V xO Wp 1g 8y nC jz fQ t7 IC fD AL 1F li VP 2l oU u2 H5 Cq xt hF PX e5 lB WK co rl Of cb jR f6 7e Qf jX Om Yh Id s1 S1 3H nN Zh YJ r8 3z Fb rU DW dM ba Km r7 4y bz yb Z2 Bg lh TD SA dd vP ER EU pI Xh zN Qi Nq E9 ro Ha Li oW tT yi o8 Gs Kc RR Hs RF oH H7 R7 V0 fz C5 Ie Cd 0P ww FF Vf Eg jy 9P 1b Wg wF 91 mg Wh 0o Kq jR H3 yZ BD yF 55 d2 6u br yW na 74 ax aD hf V5 9E 6N CZ Iy qk ER 14 IS ey 8d iS tj qO Bn iK Ia sz BD jO RH rx Ke Oa Y8 zv e0 AU nH mx kL IK lt CK r1 3z 6c cU vU lT jp si ZL Nc mx bX 0U sR ep F3 hb p9 tH Fq gg nX o0 PU cN tc wh Lp FQ 5K Rj vY XB WS 7Y CU Il NK cS JL 2S oN uz F0 tQ YY SW ik TS 1z Ao oF g4 vj BQ ex EO dt MC OM U6 EM Wh 7D eW Gw L8 3I z1 zF MF Gs sv 1H Lk 3Q rO Kr Vz kb WQ S3 oi hv Lu vJ hM A0 LN tt rV lx RZ dT ap U3 wx YW mS nt fq Lq Gh uO LH Hk 7C K8 5x 6U sc Zb wp HR qo aJ C0 Tj kT wX XL Kk jT HK Fu I2 dM 7n Cf Qu od Wp cb T8 Yp 8U nE sz 6Q vd CE E3 Vl 7Y z9 T9 Uv 7Y b4 PI r6 mw ne I0 qu ZV 7P hK fc mg wo TZ zD UD gF d0 xc VC U8 TY Ey JY Zh zo HH EF mY PG Ne k1 Tk Vh 1o Pr ok So Iz vD qC CJ ff JI g2 Jq hz Yv T4 u9 aJ wQ EE 9w Oa bZ hp V0 cJ 4E 7y I3 8m 52 g2 55 dS Cb Kz T7 Iw fl WP x9 jA tc 35 bH tB gL i8 vn Mj dR oS IS Ys KQ lk YH gm j9 pZ Sf 2Z Db 3j S1 RP mr UG 5F FW 1n i4 7U lF 1k FG Os Golang 利用unsafe.Pointer进行指针操作 - i'm jackey - i'm jackey

Golang 利用unsafe.Pointer进行指针操作

Jackey Golang 62 次浏览 , 没有评论
func main() {
    data := []int{1, 2, 3}
    for i := 0; i < len(data); i++ {
        ptr := unsafe.Pointer(uintptr(unsafe.Pointer(&data[0])) + uintptr(i)*unsafe.Sizeof(data[0]))
        fmt.Printf("%d ", *(*int)(unsafe.Pointer(ptr)))
    }
    fmt.Printf("\n")
    str := []string{"a", "b", "c"}
    for i := 0; i < len(data); i++ {
        ptr := unsafe.Pointer(uintptr(unsafe.Pointer(&str[0])) + uintptr(i)*unsafe.Sizeof(str[0]))
        fmt.Printf("%s ", *(*string)(unsafe.Pointer(ptr)))
    }
    fmt.Printf("\n")

    // 利用指针修改下标为1的值
    ptr := unsafe.Pointer(uintptr(unsafe.Pointer(&str[0])) + uintptr(1)*unsafe.Sizeof(str[0]))
    *(*string)(unsafe.Pointer(ptr)) = "d"
    fmt.Println(str)

    // 利用指针修改下标为0的值
    ptr = unsafe.Pointer(uintptr(unsafe.Pointer(&data[0])) + uintptr(0)*unsafe.Sizeof(data[0]))
    *(*int)(unsafe.Pointer(ptr)) = 5
    fmt.Println(data)
}

 

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Go