惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
F
Fortinet All Blogs
Martin Fowler
Martin Fowler
M
MIT News - Artificial intelligence
G
Google Developers Blog
P
Proofpoint News Feed
Recent Announcements
Recent Announcements
MyScale Blog
MyScale Blog
D
DataBreaches.Net
Stack Overflow Blog
Stack Overflow Blog
月光博客
月光博客
爱范儿
爱范儿
罗磊的独立博客
腾讯CDC
Hugging Face - Blog
Hugging Face - Blog
博客园 - 叶小钗
Vercel News
Vercel News
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog
C
Check Point Blog
美团技术团队
宝玉的分享
宝玉的分享
Microsoft Security Blog
Microsoft Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

博客园 - HonestMan

面试百问 公司内部推荐 debain oracle insert method a linked list, find the node that the last node point to. Get balance noe Memory - HonestMan - 博客园 ShuffleMerge---microsoft's interview question 新手开始学习linux print all Permutation of a string An funy question! Google, hire me How to interview a programmer? Binary search tree convert to double linked list. Search in Binary tree spilt a list wirte a function for counting a linked list length Remove repeat char from a string
o,1的感悟
HonestMan · 2008-04-08 · via 博客园 - HonestMan

现在每天用着高级语言编写着业务软件,渐渐感觉远离0,1了。不懂0,1一样写的很好的程序,但时常感觉心里很空,以前都是冲低级语言向高级语言。最近有种由高向低的进发,今天写个小程序纪念下:

这个程序实现了对一个整数某位的判断,这里用了C#的索引。

using System;
using System.Collections.Generic;
using System.Text;

namespace bits
{
    class bit 
    {
        private int bits;
        public bit(int bits)
        {
            this.bits = bits;
        }
        //index
        public bool this[int index]
        {
            get
            {
                return (bits & (1 << index)) != 0;
            }
            set
            {
                if (value)
                    bits |= (1 << index );
                else
                    bits &= ~(1 << index);
            }
        }
    }
}