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

推荐订阅源

M
MIT News - Artificial intelligence
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
J
Java Code Geeks
G
Google Developers Blog
美团技术团队
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
T
The Blog of Author Tim Ferriss
月光博客
月光博客
B
Blog
WordPress大学
WordPress大学
云风的 BLOG
云风的 BLOG
博客园_首页
人人都是产品经理
人人都是产品经理
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
Jina AI
Jina AI
S
SegmentFault 最新的问题
H
Help Net Security
博客园 - 聂微东
Microsoft Azure Blog
Microsoft Azure Blog
Google DeepMind News
Google DeepMind News

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