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

推荐订阅源

Engineering at Meta
Engineering at Meta
G
Google Developers Blog
WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
D
DataBreaches.Net
云风的 BLOG
云风的 BLOG
爱范儿
爱范儿
Microsoft Security Blog
Microsoft Security Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Blog — PlanetScale
Blog — PlanetScale
T
Tailwind CSS Blog
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
博客园 - 三生石上(FineUI控件)
酷 壳 – CoolShell
酷 壳 – CoolShell
Recent Announcements
Recent Announcements
T
The Blog of Author Tim Ferriss
I
InfoQ
MyScale Blog
MyScale Blog
V
V2EX
B
Blog
罗磊的独立博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 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);
            }
        }
    }
}